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: |
|
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.
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
bp_core_time_diff()to use the site’s timezone (viawp_timezone(), available since WP 5.3) when parsing MySQL datetime strings.Fixes: https://buddypress.trac.wordpress.org/ticket/9284