Skip to:
Content

BuddyPress.org

Opened 6 months ago

Last modified 4 months ago

#9284 new defect (bug)

Members widget doesnt show the correct statement of "last active".

Reported by: hexalibre's profile hexalibre Owned by:
Milestone: Awaiting Contributions Priority: highest
Severity: major Version: 14.3.2
Component: Core Keywords: has-patch needs-testing
Cc: emaralive

Description

I am using buddypress on a clients site in a timezone which is UTC + 2 hours. When a user registers NOW the widget shows for this member "registered sometime ago", cause the time cant be calculated.
Reason: Lets say its 4 PM local time, but for for buddypress it is 2 PM. This leads to a miscalculation cause wordpress stores the correct local time at the "registered at" datetime on the database.

I had a look bp_core_time_since() which calculates the time for this widget. This function relies on bp_core_current_time() which relies on WordPress's current_time(). But since WordPress 5.3 current_time() shouldn't be in use anymore cause there where some improvements. Maybe this might be the cause.

Can you fix this please.

Change History (3)

#1 @emaralive
6 months ago

  • Cc emaralive added

This ticket was mentioned in PR #413 on buddypress/buddypress by @rollybueno.


4 months ago
#2

  • Keywords has-patch added; needs-patch removed

This PR fixes an issue where BuddyPress would display incorrect "time since" values (such as "registered sometime ago") for users in non-UTC timezones. The root cause was a mismatch between the timezone of stored registration/activity dates (site local time) and the "current time" used for comparison (UTC), leading to negative or inaccurate results.

Changes

  • Updates bp_core_time_diff() to use the site’s timezone (via wp_timezone(), available since WP 5.3) when parsing MySQL datetime strings.
  • Falls back to the previous UTC-based logic for older WordPress versions.
  • Ensures both dates are compared in the same timezone, fixing the calculation for all users regardless of site timezone.

Fixes: https://buddypress.trac.wordpress.org/ticket/9284

#3 @rollybueno
4 months ago

  • Keywords needs-testing added
Note: See TracTickets for help on using tickets.