BuddyDev

Search

How to fix a issue with buddypress – current members – widget?

  • Participant
    Level: Initiated
    Posts: 16
    Josh on #55368

    I am using the buddypress members widget, a dynamic list of recently active, popular, and newest members.

    When a new member registers today this widget shows under the name “registered sometime ago” to other users which is a little bit confusing in my eyes. See image.
    https://postimg.cc/0Mnrz64T

    When I change the registration day in the database at the wordpress users table to yesterday it says “registered one day ago”.

    Is this a buddypress bug? How can I change this saying “registered today” when someone registers today instead of “sometime ago”??

    I am on latest wordpress, buddypress and running php 8.2.

  • Keymaster
    (BuddyDev Team)
    Posts: 24999
    Brajesh Singh on #55369

    Hi Josh,
    Thank you for the question.
    For some reason, BuddyPress is not able to calculate the time diff and that’s why you are seeing sometime ago.
    You can trace it from bp_get_member_registered to bp_core_get_last_activity to bp_core_time_since where the actual time is calculated.
    Since it is happening for only one users, I will suggest checking the registration timestamps for the user.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 16
    Josh on #55371

    Thanks for your quick answer. No, it happens to all users who got registered the current day.
    The timestamp buddypress takes for its calculation is the timestamp at the “user_registered” column at the users table, right?
    Then timestamp is correct, it is 2025-05-13 17:17:02 which is when the user got registered, today.

    Is there any possibility I can fix this by myself?

    • This reply was modified 1 month ago by Josh.
  • Participant
    Level: Initiated
    Posts: 16
    Josh on #55373

    I tested it going back with the registration day from now to 4 hours ago hour by hour.
    When the current time for today is 23:43:00 and I put in 21:17:02 at the user_registered column then it says “registered 26 minutes ago” at the widget.
    But it should be saying registered 2 hours and 26 minutes ago.

    Could something be wrong at my buddypress time settings? Daylight savings time?
    The time saved at the database’s users table when a user got registered is correct, I double checked.

  • Participant
    Level: Initiated
    Posts: 16
    Josh on #55374

    On my wordpress settings page it says:
    Universal time is 2025-05-13 22:12:25.
    Local time is 2025-05-14 00:12:25.

    So my local time is two hours in front of the UT.
    Is this the cause? But again, when a user got registered wordpress saves the correct time (which is my local time) at the users table.

  • Keymaster
    (BuddyDev Team)
    Posts: 24999
    Brajesh Singh on #55375

    That seems to be the problem. The issue is definately related to tmezone.
    When BuddyPress sees time diff as negative, It says ‘sometime ago’, otherwise, It shows the diff.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 16
    Josh on #55377

    But how to solve that? I am probably not the only person who is using buddypress in different timezones.

    I found this very old post about a similiar problem but this is marked as fixed. https://buddypress.trac.wordpress.org/ticket/4310

    Is it a buddypress bug within the calculating function by bp_core_time_since() cause the time settings at my client WordPress page is the way WordPress suggests?

    I had a look at the function and bp_core_time_since() uses bp_core_current_time() which uses current_time(). But regarding to this post https://developer.wordpress.org/reference/functions/current_time/ its recommended not to use this function anymore since WP 5.3.

  • Keymaster
    (BuddyDev Team)
    Posts: 24999
    Brajesh Singh on #55379

    Hi Josh,
    Thank you for the reply.

    The user registration time is stored in UTC timezone and the date calculations are done in UTC timezone, so I don’t see an issue with that.

    It has not been deprecated till 6.8 and there is no reason to worry if you are using it. “Not Recommended” is personal opinion of a user(in the comments there) and not the official version.

    I will suggest debugging to see what value it returns(It is returning negative), probably the timestamp returned by current_time is not aligned with the created timestamp value.

    Only way to find the solution is it debug the time values and calculations.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved