[buddypress-trac] [BuddyPress] #2271: whos online widget not working in some configuration due a timezone mismatch
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Fri Apr 2 09:39:52 UTC 2010
#2271: whos online widget not working in some configuration due a timezone
mismatch
----------------------------+-----------------------------------------------
Reporter: francescolaffi | Owner: francescolaffi
Type: defect | Status: new
Priority: normal | Milestone: 1.2.4
Component: Core | Keywords: whos online widget, get_users, dev-feedback
----------------------------+-----------------------------------------------
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.
--
Ticket URL: <http://trac.buddypress.org/ticket/2271>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list