Wireless

Anonymous
I'm running GL 1.4.1 and noticed the 'Site Events' doesn't include events scheduled on the current day.

Could someone point to where this is controlled so I can attempt to include the current day. I assume it's a SQL query somewhere but, couldn't figure out where.

Thanks!

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
The code is in the Calendar plugin's functions.inc, function phpblock_calendar.

Could this be a timezone issue? E.g. is your server (or maybe only your MySQL server) in a different timezone? Or maybe it's just the time on the server isn't set correctly.

bye, Dirk

Status: offline

lancelotdulac

Forum User
Newbie
Registered: 04/18/06
Posts: 5
I had the exact same issue for one of the sites I manage. I found that the SQL query did not seem to work correctly for all configurations of mysql. It worked fine on my local box, but not on the mysql installation on my web host. I have no idea what the differences between installation were, but slightly modifying the SQL query beginning on line 107 of the functions.inc file of the Calendar plugin seemed to work. The line I changed was this:

Text Formatted Code

$eventSql = 'SELECT eid,title,url,datestart,dateend,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon '
. "FROM {$_TABLES['events']} "
. "WHERE dateend >= NOW() AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) "
. 'ORDER BY datestart,timestart';
 


I changed it to this and it now works fine.

Text Formatted Code

$eventSql = 'SELECT eid,title,url,datestart,dateend,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon '
. "FROM {$_TABLES['events']} "
. "WHERE dateend >= CURDATE() AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) "
. 'ORDER BY datestart,timestart';
 


Essentially, the only modification is changing the first NOW() on the 3rd line to a CURDATE()

Hope that works for you.

-James