@almase
Active 3 years, 10 months ago
Forum Replies Created
Viewing 6 replies - 1 through 6 (of 6 total)
-
to bad that there isn`t a plugin to handle this.
ok with this code it works in the comments too
function bp_activity_comment_date_recorded_newformat( $date_recorded ) { global $activities_template; $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' ); $time_offset = $time + ( $root_blog_offset * 3600 ); // Format the time using the offset and return it; date-i18n retrieves the date in localized format return '' . date_i18n("l, j. F Y - H:i:s", strtotime($activities_template->activity->current_comment->date_recorded) + $time_offset) . ''; } add_filter('bp_activity_comment_date_recorded', 'bp_activity_comment_date_recorded_newformat', 10, 2);
i now have these codes in my function.php:
function bp_activity_comment_date_recorded_newformat( $date_recorded ) { global $activities_template; $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' ); $time_offset = $time + ( $root_blog_offset * 3600 ); $timestamp_now = time(); $timestamp_comment_date_recorded = strtotime( $activities_template->activity->current_comment->date_recorded ); if (abs($timestamp_now - $timestamp_comment_date_recorded) > 0 * 0 * 0 /* (24 hours) */) { // you can change the date format to "l, j. F Y - H:i:s" $date_recorded = date_i18n( "l, j. F Y - H:i:s", $timestamp_comment_date_recorded ); } return $date_recorded; } add_filter('bp_activity_comment_date_recorded', 'bp_activity_comment_date_recorded_newformat', 10, 2); function format_activity_date() { $activityDate=bp_get_activity_date_recorded(); // Get GMT offset from root blog $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' ); // Calculate offset time $time_offset = $time + ( $root_blog_offset * 3600 ); // Format the time using the offset and return it; date-i18n retrieves the date in localized format return '' . date_i18n("l, j. F Y - H:i:s", strtotime($activityDate) + $time_offset) . ''; } add_filter('bp_activity_time_since', 'format_activity_date');
The first posting in stream has now the right timezone, but not the comments… 🙁
dont really understand.
this code?function bp_get_activity_comment_date_recorded() { global $activities_template; if ( empty( $activities_template->activity->current_comment->date_recorded ) ) return false; $date_recorded = bp_core_time_since( $activities_template->activity->current_comment->date_recorded ); /** * Filters the recorded date of the activity comment currently being displayed. * * @since BuddyPress (1.5.0) * * @param string|bool Date for the activity comment currently being displayed. */ return apply_filters( 'bp_activity_comment_date_recorded', $date_recorded ); }
and add to function.php?
Ok i found here an other code:
https://buddypress.org/support/topic/activity-time-is-gmt-activity-stream-posted-an-update-time-is-incorrect/function format_activity_date() { $activityDate=bp_get_activity_date_recorded(); // Get GMT offset from root blog $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' ); // Calculate offset time $time_offset = $time + ( $root_blog_offset * 3600 ); // Format the time using the offset and return it; date-i18n retrieves the date in localized format return '' . date_i18n("l, M j, Y, g:ia T", strtotime($activityDate) + $time_offset) . ''; } add_filter('bp_activity_time_since', 'format_activity_date');
The timezone is now the right one for the first posting in stream, but the comments in stream have now the wrong timezone…. 🙁
I have the same problem 🙁
Pls help!
Viewing 6 replies - 1 through 6 (of 6 total)