public
Last active

Buddypress - Change activity & comments date format

  • Download Gist
Buddypress_change_data_format
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
//---------------------------------------------------//
// Change activity since time to exact data+time
//---------------------------------------------------//
 
add_filter('bp_activity_time_since', 'bp_activity_time_since_newformat', 10, 2);
function bp_activity_time_since_newformat( $time_since, &$actvitiy ) {
 
// you can change the date format to "Y-m-d H:i:s"
$time_since = '<span class="time-since">' . date_i18n("F j, Y", strtotime( $actvitiy->date_recorded ) ) . '</span>';
return $time_since;
}
 
 
add_filter('bp_activity_comment_date_recorded', 'bp_activity_comment_date_recorded_newformat', 10, 2);
function bp_activity_comment_date_recorded_newformat( $date_recorded ) {
global $activities_template;
// you can change the date format to "Y-m-d H:i:s"
$date_recorded = date_i18n("F j, Y", strtotime( $activities_template->activity->current_comment->date_recorded );
return $date_recorded;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.