Loading...
 
Features / Usability

Features / Usability


mod-upcoming_events problems

posts: 3665 United States

On my 1.9 Tiki the default mod-upcoming_events seems to show the last "x" events in the calendar, not the next "x" events as I wanted.

I looked at the query, and changed:

Image
Copy to clipboard
$cond = $cond." and `start` < (unix_timestamp(now()) + ?)";

to

Image
Copy to clipboard
$cond = $cond." and `start` > (unix_timestamp(now()))";


The query needs to find events that start after the current time, right?

The module now shows events that start after the current day (the next events), as I wanted, but it shows all events in the calendar. The query no longer seems to respect the rowlimit. What did I do wrong?

I tried adding a LIMIT 1,5 to the query, but I keeping getting a SQL error.

Thanks,

-Rick

posts: 1

I was having the same problem, and here's what I changed to fix it (Tiki version 1.9.1):

On line 776 of lib/calendar/calendarlib.php:

Image
Copy to clipboard
$cond = $cond." and `start` < (unix_timestamp(now()) + ?)";

to

Image
Copy to clipboard
$cond = $cond." and `start` > (unix_timestamp(now())) and `start` < (unix_timestamp(now()) + ?)";


and on line 779 of lib/calendar/calendarlib.php:

Image
Copy to clipboard
$query = "select `start`, `name`, `calitemId`, `calendarId`, `user`, `lastModif` from `tiki_calendar_items` where 1=1 ".$cond." order by ".$this->convert_sortmode('start_desc');

to

Image
Copy to clipboard
$query = "select `start`, `name`, `calitemId`, `calendarId`, `user`, `lastModif` from `tiki_calendar_items` where 1=1 ".$cond." order by ".$this->convert_sortmode('start_asc');


the change being start_asc (sort ascending) instead of start_desc (sort descending).

This is working well for our install, however I haven't tested any weird conditions (no cal entries, no future cal entries, etc.).


posts: 1092

It has been fixed in 1.9.2 , I think (fixes around oct 3rd)
sylvie