Upcoming Events Module

posts: 1

I don't know how to submit this properly... hopefully someone can point me n the right direction. I noticed the upcoming events module showed all events, and sorted them from the latest event down to the current day... When I changed the sort it showed even events that had already passed.

I modified the calendarlib.php file funtion upcoming_events to adjust this so that it only shows UPCOMING events that havent' passed yet, with the nearest event listed first. I don't know how to put this into CVS and I hope this change doesn't affect other calendar type items.

function upcoming_events($maxrows = -1, $calendarId = 0, $maxDays = -1) {
$cond = '';
$bindvars = array();
if($calendarId > 0){
$cond = $cond." and `calendarId` = ? ";
$bindvars = $bindvars + array($calendarId);
if($maxDays > 0)
$maxSeconds = ($maxDays * 24 * 60 * 60);
$cond = $cond." and `start` > (unix_timestamp(now()) )";
$bindvars = $bindvars + array($maxSeconds);
$query = "select `start`, `name`, `calitemId`, `calendarId`, `user`, `lastModif` from `tiki_calendar_items` where 1=1 ".$cond." order by ".$this->convert_sortmode('start_asc');

$result = $this->query($query,$bindvars,$maxrows,0);

$ret = array();

while ($res = $result->fetchRow()) {
$ret[] = $res;

return $ret;

posts: 111 Taiwan

- is that code functional ? by reading it I feel that there is a problem with match beetween number of ? in query (content of $cond) and number of items in $bindvars. Anyway your code seem to refer to an early 1.9 version of tikiwiki, and that function changed (a little) in 1.9 CVS already.

About accessing the CVS, read CvsForDevelopers and TikiCVSHowTo