Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity Time is GMT. Activity Stream "Posted an Update" time is incorrect.


  • wpmirwin
    Participant

    @wpmirwin

    Hi everybody,

    Sorry for the subject – not enough room to describe what this is all about. I’m having issues with the way BuddyPress converts/displays date/time in various places. I have read everything I can find here on buddypress.org, but nothing has been helpful so far.

    Here is the summary

    * WP: 3.4.2
    * BP: 1.6.1

    * Server setting for date/time is ok
    * Straight WP handling of date/time is ok (i.e. new posts have the correct date/time, etc)
    * date/time is stored at the DB in GMT in all cases (this date/time is always correct in GMT)

    * date/time is converted properly based on timezone for the BuddyPress Group forum topic itself. i.e. “user said 5 days, 8 hours ago:” – this is correct. (-5 for me .. EST)

    * date/time seems to be converted twice (-10) for the corresponding BuddyPress Activity Stream record as seen by the end user

    * date/time is not converted at all for the same Activity Stream record when viewed via WP Admin. i.e. the time is straight GMT from the DB.

    Here are the details:

    1). From what I can tell (I used shared hosting), the Centos Linux box that hosts my site has the date/time set correctly.

    I asked them to issue the date command and send the result. What they provided was the result when logging into the box via SSH. i.e. “Sun Jan 27 10:45:24 CST 2013″. The server is hosted somewhere in the CST timezone, and the date/time was correct at the time this info was sent.

    2). I am in the EST time zone. My WP general/settings/timezone is set to Montreal.

    3). When I publish a WP Post (for example) everything is fine. The “published on” date/time is correct (in local / EST / Montreal time). In fact, everything to do with straight WP date/time related handling is fine. BuddyPress is a different story!

    4). BuddyPress: When someone sends a private message, the time on the received email is one hour behind. I assume this can be explained by the CST server time and the EST timezone I’ve chosen in WP Settings/General/timezone. I can live with this – Or could change the timezone to the server timezone (chicago / CST).

    This is where it gets interesting.

    5). BuddyPress: When somebody creates or adds to a topic in BuddyPress Group Forum, the date/time is also correct. i.e. “username said n seconds ago” is 1 second after the update is made. OK.. But, the corresponding Activity entry shows 5 hours and 1 second ago. i.e. 5 hours in the past!

    Looking at the Activity Table record via phpMyAdmin, the date is stored in GMT (i.e. + 5 hours as I am in EST).

    Looking at the Topics Table record via phpyMyAdmin, the date is exactly the same – i.e. stored in GMT.

    So, when the forum topic is displayed, it’s doing a proper conversion from GMT to local time (-5), but the Activity Stream page seems to be doing the conversion twice, and I end up with -10 hours from the stored time in GMT.

    6). BuddyPress: Of course, when somebody just posts something to the activity stream, it always shows up as “username said 5 hours and n seconds ago” also. i.e. a -10 conversion from the stored db time which is in GMT.

    7). BuddyPress: Finally, when looking at the Activity via WP Admin, the date/time on each entry is straight out of the DB – i.e. GMT time – No local time conversion at all!

    If anybody can make sense of what’s going on, I’d really appreciate it! I will provide any information that you need and access to the system if required.

    Best regards,
    Mike.

    NOTE: I replied to another topic with these same questions here:

    http://buddypress.org/support/topic/buddypress-activity-time-is-off-by-5-hours/#post-151831

    I’m not try to post this all over the place, I just want to make sure it’s in the right place!

Viewing 25 replies - 1 through 25 (of 27 total)

  • Ben Hansen
    Participant

    @ubernaut

    i’m pretty sure this is a known issue but I’m not sure if there a trac ticket for it.


    wpmirwin
    Participant

    @wpmirwin

    @ubernaut .. Hi Ben,

    Thanks for the quick reply. The only Trac ticket I could find that was close is this one.

    https://buddypress.trac.wordpress.org/ticket/4573

    It only addresses the issue where in WP Admin, the Activity time is +5 hours ahead of local time. The person who reported the problem may also have been in the EST timezone (-5) which means that the straight up GMT time from the dB would be +5 hours ahead of local time.

    However, the Trac ticket was closed by DJPaul 3 months ago. I’m not sure what the protocol is to have it be considered as a possible bug again.

    .. and my issue has another angle in that the Activity time that the end user sees in BP is -5 hours behind local time!

    So relative to local time, I have buddypress related times that are -5 hours, correct time, and +5 hours off. Yikes! 🙂

    Thanks,
    Mike.


    Ben Hansen
    Participant

    @ubernaut

    well i was saying it is a known bug referring back to this thread but like i said i don’t know if theres a ticket yet:

    https://buddypress.org/support/topic/time-fifference-buddypress-activity-and-bbpress/


    wpmirwin
    Participant

    @wpmirwin

    @ubernaut

    Thanks for link. I didn’t see that topic.. It’s hard to find things sometimes.

    I’m going to keep looking into it. It’s a crummy bug. I didn’t notice this in testing and I have a live site up where nothing is happening in the activity stream… it’s always 5 + hours in the past! 🙂

    The +5 hours on the records in the WP Admin Activity isn’t very nice, but at lease the end user doesn’t see it.

    Mike.


    shanebp
    Moderator

    @shanebp

    You can always submit a bug ticket on
    https://buddypress.trac.wordpress.org/ticket/4573

    Use the same login you use here. Provide an url where they can see the issue.


    Ben Hansen
    Participant

    @ubernaut

    The +5 hours on the records in the WP Admin Activity isn’t very nice, but at lease the end user doesn’t see it.

    yeah thats kinda how i feel too lower priority item but still somewhat annoying.


    wpmirwin
    Participant

    @wpmirwin

    @ubernaut

    Forgot to ask.. have you tested this on a vanilla WP BP install? I’m just about to build up another environment, but thought I’d ask you first before burning the midnight oil….. 🙁

    Mike.


    Ben Hansen
    Participant

    @ubernaut

    my understanding is that this issue exists on all buddypress installs (i could be wrong).


    wpmirwin
    Participant

    @wpmirwin

    Hmmm.. I didn’t realize that. We’ll I’m glad you mentioned it…. Means I’m going to bed instead! 😉


    Ben Hansen
    Participant

    @ubernaut

    probably the right move 😉


    mgkoller
    Participant

    @mgkoller

    have you tested this on a vanilla WP BP install

    If it helps at all I got the times working using the BBpress forum running alongside BuddyPress, But I’m still having the same issues that you posted regarding the BuddyPress Activity times.

    BBPress Screenshot
    BBPress Time Example


    Ben Hansen
    Participant

    @ubernaut

    i asked about this in the devchat today sounds like its on the roadmap for 1.8 fix


    wpmirwin
    Participant

    @wpmirwin

    @mgkoller – Thanks for adding your comments / helping me out.

    Whey you say that you got the times working using the BBpress forum running alongside BuddyPress, do you mean the times in the forum itself, or the times in the BP Activity Stream that reference what was posted in the Forum? i.e. ” posted an update in the ..blah blah… hours ago”?

    For me, the time in the actual forum works fine. i.e If I created a new topic right now it would say ” said 1 second ago”. But if I immediately go to the BP Activity Stream, it says that I started a new topic 5 hours and 1 second ago.

    .. and then of course I have the problem as everyone else in WP Admin Activity where the same activity as above is 5 hours ahead.

    Thanks!
    Mike.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Known issue since forever ago, but we’ve never had a good consistent report on where it’s happening and how to duplicate it. Thanks everyone for the info, and for the trac ticket.


    wpmirwin
    Participant

    @wpmirwin

    @johnjamesjacoby – Hi John. Really great to see your face/name on a problem that I’d like to see resolved! 😉 Thanks for all your great work. It’s really appreciated.

    Mike.


    Ypswytch
    Participant

    @ypswytch

    I’m looking forward to the 1.8 fix for this as I’ve been dealing with this issue for several years now.
    I just upgraded to Buddypress 1.7 from 1.2 and I’m trying to set up my site so that I’m customizing it the correct way instead of editing theme files and core files. Fear of losing my customizations is what has kept me from upgrading.
    My users complained that they wanted to see the actual date and time in the Activity stream, and they also wanted to know the time zone. It would be nice if we had an easy way to show the actual date and time instead of the “time since”.
    I am able to get around this problem by doing the following (which may or may not be the best way to approach it):
    1. Under Settings General I have my time set for New York (eastern time).
    2. I created a functions.php file and put it in my customized buddypress default theme.
    3. In the functions.php file I added the following function and filter:

    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');
    

    I wish I could say I completely understand why this works. I hope it’s still showing the correct time when we go off daylight savings time in the fall.


    Ben Hansen
    Participant

    @ubernaut

    neat thanks for sharing!


    MrsAngelD
    Participant

    @mrsangeld

    @Ypswytch

    Thank you so much for posting that, it fixes things nicely 🙂


    wpmirwin
    Participant

    @wpmirwin

    @ypswytch

    Thank-you! This is the best solution to the problem so far. I think it’s great. Thanks for sharing!

    Mike.


    MrsAngelD
    Participant

    @mrsangeld

    I want to mention, that I no longer needed this code once I set my time in wordpress using UTC instead of the city. It fixed the issue right up.

    So I went to wp-admin -> settings -> general ->Timezone

    and used UTC time instead of the city.


    wpmirwin
    Participant

    @wpmirwin

    @mrsangeld

    I tried setting my time in WP using UTC also, but it didn’t work for me. Glad you’ve got it all straightened out though (I’m still on BP 1.6.1 – maybe this has something to do with it). For now I’ll need to use this function.

    Mike.


    MrsAngelD
    Participant

    @mrsangeld

    @wpmirwin yeah that could be the difference, I’m using the latest Buddypress.


    mgkoller
    Participant

    @mgkoller

    The dashboard > activity is correctly displaying after applying trishasala’s patch (4573.patch)

    https://buddypress.trac.wordpress.org/ticket/4573#comment:19


    wpmirwin
    Participant

    @wpmirwin

    Dashboard Activity times are also displaying correctly for me (WP 4.3.2 / BP 1.6.1.) after applying the changes in tishasala’s patch (4573.patch).

    Thank-you!


    Trisha Salas
    Participant

    @trishasalas

    @mgkoller, @wpmirwin good to hear it, thanks for the update!

Viewing 25 replies - 1 through 25 (of 27 total)
  • The topic ‘Activity Time is GMT. Activity Stream "Posted an Update" time is incorrect.’ is closed to new replies.
Skip to toolbar