News:

Wondering if this will always be free?  See why free is better.

Main Menu

ssi show upcoming events

Started by doublea2k7, July 17, 2009, 05:09:17 PM

Previous topic - Next topic

doublea2k7

i have trouble showing upcoming events like in the near future (1-10 days ahead) in my homepage using the ssi.

im using ssi_recentEvents but it only shows events for todays date.

here is a snippet of the code that i think needs to be change in order to make this work but i need some help modifying it.
// Find all events which are happening in the near future that the member can see.
$request = db_query("
SELECT
cal.ID_EVENT, cal.startDate, cal.endDate, cal.title, cal.ID_MEMBER, cal.ID_TOPIC,
cal.ID_BOARD, t.ID_FIRST_MSG
FROM {$db_prefix}calendar AS cal
LEFT JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = cal.ID_BOARD)
LEFT JOIN {$db_prefix}topics AS t ON (t.ID_TOPIC = cal.ID_TOPIC)
WHERE cal.startDate >= '" . strftime('%Y-%m-%d', forum_time(false)) . "'
AND cal.endDate >= '" . strftime('%Y-%m-%d', forum_time(false)) . "'
AND (cal.ID_BOARD = 0 OR $user_info[query_see_board])
ORDER BY cal.startDate DESC
LIMIT $max_events", __FILE__, __LINE__);


Any help is greatly appreciated

N3RVE

Moving to a more appropriate section :).

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Bulakbol

I believe the SSI only display today's event. To make it display more events, copy ssi_recentEvents() function, rename the new function and edit it. Changes are copied from Subs.php.

SSI.PHP
Code (find) Select
// Find all events which are happening in the near future that the member can see.
Code (add before) Select
$low_date = strftime('%Y-%m-%d', forum_time(false) - 24 * 3600);
$high_date = strftime('%Y-%m-%d', forum_time(false) + $modSettings['cal_days_for_index'] * 24 * 3600);


Code (find) Select
WHERE cal.startDate <= '" . strftime('%Y-%m-%d', forum_time(false)) . "'
AND cal.endDate >= '" . strftime('%Y-%m-%d', forum_time(false)) . "'

Code (replace) Select
WHERE cal.startDate <= '$high_date'
AND cal.endDate >= '$low_date'


Try it. Might work for you.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

la muerte

I know this is an old SMF 1.X support thread but I've been dieing to get this to run on SMF 2.0.2 and have had 0 success and 0 help so far so perhaps someone could help me getting this same thing to work for 2.0.2?

Advertisement: