Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 4 years ago

#2271 closed defect (bug) (fixed)

whos online widget not working in some configuration due a timezone mismatch

Reported by: francescolaffi Owned by: francescolaffi
Milestone: 1.2.4 Priority: normal
Severity: normal Version:
Component: Core Keywords: whos online widget get_users dev-feedback has-patch
Cc: francescolaffi, courtneybostdorff@…

Description

problem described and solved in this forum post http://buddypress.org/forums/topic/whos-online-widget-not-working-think-its-a-mysql-timezone-problem

Short sum: last activity is stored as utc and compared to mysql NOW() that return the time in the server timezone.

Solution: change in bp-core-classes.php:139 (in the get_users function)

$sql['where_online'] = "AND DATE_ADD( um.meta_value, INTERVAL 5 MINUTE ) >= NOW()";

with

$sql['where_online'] = "AND DATE_ADD( um.meta_value, INTERVAL 5 MINUTE ) >= UTC_TIMESTAMP()";

Going to make a diff with this solution. If there are other queries that compare an utc timestamp with now() probably they should be changed too.

Attachments (1)

2271.diff (942 bytes) - added by francescolaffi 10 years ago.

Download all attachments as: .zip

Change History (8)

@francescolaffi
10 years ago

#1 @francescolaffi
10 years ago

  • Keywords has-patch added

#2 @NickRita
10 years ago

The solution worked for me! wp 292, bp 123

#3 @johnjamesjacoby
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed by r2890.

#4 @NickRita
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Okay, call was too early. The solution still works, BUT

I'm on UTC+2 (Germany).

The widget works, but now, in the list of messages, there is shown "message 30 minutes ago" althought it in fact was 2 hours and 30 minutes ago.

For me it is more important, that the widget works, but maybe someone can find a solution for the message-problem, too.

#5 @apeatling
10 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Messages bug is unrelated.

#6 @courtneybostdorff
4 years ago

  • Keywords changed from whos online widget, get_users, dev-feedback has-patch to whos online widget get_users dev-feedback has-patch
  • Severity set to normal

Hello, wow this is an old topic. I recently installed a fresh copy of both WP and BP. For whatever reason, the WHO's ONLINE widget shows me nothing though I have multiple users logged in at the same time. Also, the "RECENTLY ACTIVE MEMBERS" widget shows me nothing, however, the "MEMBERS" widget shows the members and their latest activity.

It seems that this topic has been resolved since 7 years ago as I can find no recent posts with the same issue. I attempted the solution in this post but the bp-core-classes.php file no longer contains the same code as it did back then.

I tried using the default wp theme, tried disabling all plugins and then reactivating to check for compatibility issues, tried removing and then adding the widgets, tried changing timezones.......but no dice.

Anyone have any suggestions? Thanks!

Courtney

#7 @courtneybostdorff
4 years ago

  • Cc courtneybostdorff@… added
Note: See TracTickets for help on using tickets.