WordPress.org

Ready to get started?Download WordPress

Forums

Social
[resolved] Timestamps broken (16 posts)

  1. logantscott
    Member
    Posted 1 year ago #

    Timestamps are not showing the correct times, seems to be pretty random and inaccurate. And threaded comments seem to be showing their timestamps in reverse order (once any comment gets a reply).

    http://wordpress.org/extend/plugins/social/

  2. logantscott
    Member
    Posted 1 year ago #

    Decided to try and figure this out myself... here's what I found.

    Timezone isn't taken into account when comparing dates. The comment_date_gmt gets compared with time(), which is local for me because I've set the timezone in my header.php via date_default_timezone_set('America/Los_Angeles') (I think I had trouble getting the timezone to work by setting it in the backend and/or in the ini file).

    Not sure what the best workaround is. I'm just going to try setting the local time myself in date.php.

  3. dverbrugge
    Member
    Posted 1 year ago #

    The timestamps (in my case) seem to be of the time they were 'imported'. I just installed 2.6, activated the Social Comments and all comments were imported with the same timestamp...

  4. surroundedby
    Member
    Posted 1 year ago #

    I'm have the same problem on 2 separate websites that social has been added to. Some comments from a year ago now say 9 hours ago. And a like from facebook yesterday now says it was 19 minutes ago.

    This is nothing to do with Timezones. Is anyone else having an issue with this?

  5. logantscott
    Member
    Posted 1 year ago #

    I just realized I'm having this problem too. I'm going to look into it later today and see if I can figure out what's going on.

  6. logantscott
    Member
    Posted 1 year ago #

    In social/lib/social/date.php, some functions were changed in the most recent version. In the function span_comment, each 'if statement' originally returned the output when it was first matched (years ago, months ago, weeks ago, etc.), but 'return' was replaced with a variable and now it matches all the way down and returns at the end (with the last match being hours/minutes, so it only returns that).

    I replaced the span_comment function with this, and it seems to be working now. There were a couple other problems that this fixed too (weird issues with hours and minutes).

  7. dverbrugge
    Member
    Posted 1 year ago #

    Thanks @logantscott !!
    After changing the same code this seems to show the correct date/time!
    However, still some issues:

    1) it is not using the correct localizations for all entries...
    See: http://dennisennynke.nl/2012/10/16/hier-komt-dat-feestje
    (top 3 Facebook comments use nl_NL, other likes are in English)

    2) it shows Facebook likes still by the date they were imported (or is this inherent to the plugin?)

  8. logantscott
    Member
    Posted 1 year ago #

    1) I personally don't know much about localization. Did you mix that up? I see the top 3 in English and the others in... not english (nl?). I noticed another error in the function with "weeks" and I'll link the new one below.

    LINK - span_comment

    2) I also don't know how Social imports comments... do you mean the WordPress comments? Social just looks at the timestamps in the comments table. I don't know if you know how to look at the database (with phpMyAdmin or something), but if you look at those comments in the comments table, see if the timestamps are correct there.

  9. logantscott
    Member
    Posted 1 year ago #

    Also on 2)... I don't think this plugins social aggregation features are really working as intended. I'll have to 'like' one of my posts later so I can see if this is happening to me.

  10. dverbrugge
    Member
    Posted 1 year ago #

    1) the fix for that error seems to fix the localization as well! Now displaying correctly.

    2) I meant Facebook Likes. They seem to be timestamped with the time they are aggregated by Social. Which is no problem, if the aggregation happens within the hour of the Facebook Like.
    (But I broadcasted some posts a few months ago and only last week turned Fetch/aggregation on, so the Facebook likes on those posts have a timestamp of a week ago...)

  11. Alex King
    Member
    Plugin Author

    Posted 1 year ago #

    Facebook doesn't provide date information for Likes. We do the best we can.

    Please create a pull request on GitHub (or just open a ticket) and we can merge in any enhancements:

    https://github.com/crowdfavorite/wp-social

  12. mentalist3d
    Member
    Posted 1 year ago #

    @logantscott: Thanks for sharing your solution, worked a charm ;)

  13. Kelson
    Member
    Posted 1 year ago #

    @loganscott: This solution worked for me too, thanks!

  14. Jonathan D. Johnson (jondavidjohn)
    Member
    Posted 1 year ago #

    @logantscott Thanks for the help figuring this one out, this will be fixed in the next release.

  15. nycgadgetgirl
    Member
    Posted 1 year ago #

    @logantscott: Also just saying thanks for formulating and posting this solution!

  16. logantscott
    Member
    Posted 1 year ago #

    @Alex

    Sorry I didn't make a ticket or something, don't really understand how to use GitHub. I just wanted to try to fix the code for this plugin because it seems like the closest plugin to what I'm looking for. I know there were other functions in date.php that looked like they needed to be fixed too (span_formatted and maybe fuzzy). Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic