This is from somebody else's hack. Simply search for this:
// Called from BoardIndex.php to display the current day's events on the board index.
function CalendarDoIndex()
{
Replace the
entire function with this:
Note that this should be the very last function in the file Sources\Calendar.php
// Called from BoardIndex.php to display the current day's events on the board index.
function CalendarDoIndex()
{
global $modSettings, $db_prefix, $txt, $imagesdir, $settings, $scripturl, $mydate;
if ($modSettings['cal_enabled'] != 1)
return;
// Make sure at least one of the options is checked.
if ($modSettings['cal_showeventsonindex'] != 1 && $modSettings['cal_showbdaysonindex'] != 1 && $modSettings['cal_showholidaysonindex'] != 1)
return;
//$today = localtime(CalendarGetAnyTime());
//$month = $today[4];
//$year = $today[5] + 1900;
//$day = $today[3];
$todaytime2 = CalendarGetCurrentTime();
$header = '
<tr>
<td class="catbg" colspan="2"><b>' . $txt['calendar47'] . '</b></td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
<a href="' . $scripturl . '?action=calendar">
<img src="' . $imagesdir . '/calindex.gif" border="0" width="20" alt="' . $txt['calendar24'] . '" />
</a>
</td><td class="windowbg2" width="100%"><table class="windowbg2" width="100%">';
$bechoedHeader = false;
$bPrintedHeader = true;
echo $header;
$PrintedHeader2 = false;
for ($i = 0; $i < 15; $i++)
{
$todaytime = $todaytime2 + 3600 * 24 * $i;
$today = localtime($todaytime);
$month = $today[4];
$year = $today[5] + 1900;
$day = $today[3];
$mydate = date("l, F jS, Y", $todaytime);
if ($modSettings['cal_showholidaysonindex'] == 1)
{
$holidays = CalendarCreateHolidayArray($month + 1, $year, $day);
if (isset($holidays[$day]))
{
if (!$bPrintedHeader)
{
echo $header;
$bPrintedHeader = true;
}
echo '<tr class="windowbg2" width="100%"><font size="1" color="#' . $modSettings['cal_holidaycolor'] . '"><b>' . $mydate . '</b>: ' . $holidays[$day] . '</font>';
$PrintedHeader2 = true;
}
}
if ($modSettings['cal_showbdaysonindex'] == 1)
{
$bday = CalendarCreateBirthdayArray($month + 1, $year, $day);
if (isset($bday[$day]))
{
if (!$bPrintedHeader)
{
echo $header;
$bPrintedHeader = true;
}
if (isset($holidays[$day]))
echo '<br />';
echo '<tr class="windowbg2" width="100%"><font size="1"><b>' . $mydate . '</b>: ' . $bday[$day] . '</font>';
$PrintedHeader2 = true;
}
}
if ($modSettings['cal_showeventsonindex'] == 1)
{
$bPowerUser = ($settings[7] == 'Administrator' || $settings[7] == 'Global Moderator');
$cats = array();
$rs = mysql_query("SELECT ID_CAT,membergroups FROM {$db_prefix}categories") or database_error(__FILE__, __LINE__);
while ($row = mysql_fetch_array($rs))
$cats[$row[0]] = explode(',', $row[1]);
$events = CalendarCreateEventArray($bPowerUser, $cats, $month, $year, $day);
if (isset($events[$day]))
{
if (!$bPrintedHeader)
{
echo $header;
$bPrintedHeader = TRUE;
}
if (isset($bday[$day]) || isset($holidays[$day]))
echo '<br />';
echo '<tr class="windowbg2" width="100%"><font size="1"><b>' . $mydate . '</b>: ' . $events[$day] . '</font>';
$PrintedHeader2 = true;
}
}
if ($bPrintedHeader)
echo '
</td>';
}
if (!$PrintedHeader2)
echo 'Nothing is scheduled.</td>';
echo '
</tr></table></tr>';
Then once you've done that, look for this (in that new same function:
$bPrintedHeader = true;
echo $header;
$PrintedHeader2 = false;
for ($i = 0; $i < 15; $i++)
{
and change the
< 15 to
< 6 ( number of days to display + one)
Hope this helps, looks great on my board.