Version: 1.00, by PlickBadger
Developer Last Online: Aug 2014
Category: Mini Mods -
Version: 3.8.2
Rating:
Released: 07-07-2009
Last Update: Never
Installs: 6
Code Changes
No support by the author.
If you want your calendar to adhere to the Active Members Time Cut-Off and the Show birthdays for active users only Active Members option. Modify the following files
modify your /forum/includes/functions_calendar.php as follows:
find
PHP Code:
function cache_birthdays($weekly = 0)
{
global $doublemonth, $vbulletin, $calendarinfo, $doublemonth1, $doublemonth2;
$birthday = array();
add the following directly below it
PHP Code:
// calendar hack to limit birthdays to active users pulled directly from functions_databuild.php
if ($vbulletin->options['activememberdays'] > 0 AND ($vbulletin->options['activememberoptions'] & 1))
{
$datecut = TIMENOW - (intval($vbulletin->options['activememberdays']) * 86400);
$activitycut = "AND lastactivity >= $datecut";
}
else
{
$activitycut = '';
}
Then add
PHP Code:
$activitycut
to the end of the following 2 SQL statements
before:
PHP Code:
if (!$weekly)
{ // cache birthdays for a single month
$birthdays = $vbulletin->db->query_read_slave("
SELECT birthday, username, userid, showbirthday
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE '$doublemonth-%' AND
usergroupid IN ($ids) AND
showbirthday IN (2, 3)
");
}
else
{ // cache for two months!
$birthdays = $vbulletin->db->query_read_slave("
SELECT birthday, username, userid, showbirthday
FROM " . TABLE_PREFIX . "user
WHERE (birthday LIKE '$doublemonth1-%' OR
birthday LIKE '$doublemonth2-%') AND
usergroupid IN ($ids) AND
showbirthday IN (2,3)
");
}
after:
PHP Code:
if (!$weekly)
{ // cache birthdays for a single month
$birthdays = $vbulletin->db->query_read_slave("
SELECT birthday, username, userid, showbirthday
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE '$doublemonth-%' AND
usergroupid IN ($ids) AND
showbirthday IN (2, 3)
$activitycut ");
}
else
{ // cache for two months!
$birthdays = $vbulletin->db->query_read_slave("
SELECT birthday, username, userid, showbirthday
FROM " . TABLE_PREFIX . "user
WHERE (birthday LIKE '$doublemonth1-%' OR
birthday LIKE '$doublemonth2-%') AND
usergroupid IN ($ids) AND
showbirthday IN (2,3)
$activitycut ");
}
Then modify your /forum/calendar.php as follows: find
PHP Code:
// set date range for events to cache.
$eventrange = array('frommonth' => $month, 'fromyear' => $year, 'nextmonth' => $month, 'nextyear' => $year);
// cache events for this month only.
$eventcache = cache_events($eventrange);
add the following directly below it
PHP Code:
// calendar hack to limit birthdays to active users pulled directly from functions_databuild.php
if ($vbulletin->options['activememberdays'] > 0 AND ($vbulletin->options['activememberoptions'] & 1))
{
$datecut = TIMENOW - (intval($vbulletin->options['activememberdays']) * 86400);
$activitycut = "AND lastactivity >= $datecut";
}
else
{
$activitycut = '';
}
Then add
PHP Code:
$activitycut
To the following SQL statement before:
PHP Code:
if ($calendarinfo['showbirthdays'])
{ // Load the birthdays for today
foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
{
if ($usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'])
{
$ids .= ",$usergroupid";
}
}
$comma = '';
$birthday = $db->query_read_slave("
SELECT birthday, username, userid, showbirthday
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE '$doublemonth-$doubleday-%' AND
usergroupid IN (0$ids) AND
showbirthday IN (2,3)
");
after:
PHP Code:
if ($calendarinfo['showbirthdays'])
{ // Load the birthdays for today
foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
{
if ($usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'])
{
$ids .= ",$usergroupid";
}
}
$comma = '';
$birthday = $db->query_read_slave("
SELECT birthday, username, userid, showbirthday
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE '$doublemonth-$doubleday-%' AND
usergroupid IN (0$ids) AND
showbirthday IN (2,3)
$activitycut ");
I did not write this code, I swiped it from functions_databuild.php, but I thought it might be useful to someone
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
If you want your calendar to adhere to the Active Members Time Cut-Off and the Show birthdays for active users only Active Members option
What, i don`t really understand what you`re saying in that phrase, lol !?
This mod will show me in memberlist who is celebrating his birthday ?
Its interesting, good mod, too bad it has to have template edits cause everytime you update vB and the template with it you need to do this edit again and if you have like 20 mods like this...
I always wanted to to have a better memberlist to see more about users, like their COUNTRY and other stuff ! 10x
The Forum Home Page options (Active Members Time Cut-Off and the Show birthdays for active users only) in the AdminCP limit the birthdays shown on the home page to users that have been active within certain amount of days.