Skip to content

Instantly share code, notes, and snippets.

@shanebp
Created May 1, 2013 19:34
Show Gist options
  • Save shanebp/5497723 to your computer and use it in GitHub Desktop.
Save shanebp/5497723 to your computer and use it in GitHub Desktop.
Filter time if off by 7 hours
// add 7 hours in the filters below
function shane_local_time( $timestamp ) {
$unixTimestamp = strtotime( $timestamp );
$unixTimestamp = $unixTimestamp + (7 * 3600);
$filtered_time = date("Y-m-d H:i:s", $unixTimestamp);
return $filtered_time;
}
/**
* Filters the 'last active' screen output
*/
function shane_local_time_last_active( $last_active, $last_activity_date, $string ) {
$filtered_time = shane_local_time( $last_activity_date );
$last_active = sprintf( $string, bp_core_time_since( $filtered_time ) );
return $last_active;
}
add_filter( 'bp_core_get_last_activity', 'shane_local_time_last_active', 1, 3 );
/**
* Filters the 'time_since' screen output
*/
function shane_bp_activity_time_since( $output, $activity ) {
$filtered_time = shane_local_time( $activity->date_recorded );
$output = bp_core_time_since( $filtered_time );
return $output;
}
add_filter('bp_activity_time_since', 'shane_bp_activity_time_since', 1, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment