************************************************** * Who Was Online Today * Created by: Gary W (http://www.vbulletin.org/forum/member.php?u=5183) ************************************************** FILE MODIFICATIONS index.php TEMPLATE MODIFICATIONS FORUMHOME forumhome_todayloggedinuser forumhome_todayloggedinusers ****************************** RUN THIS QUERY (IF YOU HAVEN'T RAN THE INSTALLER.PHP FILE BEFORE) ****************************** INSERT INTO datastore (title, data) VALUES ('todaymaxonline', 'a:2:{s:14:\"todaymaxonline\";i:1;s:18:\"todaymaxonlinedate\";i:1070000000;}') ****************************** OPEN index.php AND FIND ****************************** 'mailqueue' ****************************** REPLACE WITH ****************************** 'mailqueue', 'todaymaxonline' ****************************** FIND ****************************** 'forumhome_subforumseparator_post' ****************************** REPLACE WITH ****************************** 'forumhome_subforumseparator_post', 'forumhome_todayloggedinuser', 'forumhome_todayloggedinusers' ****************************** FIND ****************************** // ### GET FORUMS & MODERATOR iCACHES ######################## ****************************** ABOVE THAT, PUT THIS ****************************** // ### WHO WAS ONLINE TODAY ######################## if ((int)$maxusers['maxonline'] <= $totalonline) { $time = time(); $maxloggedin = "$totalonline " . $time . " " . $maxusers['maxonline'] . " " . $maxusers['maxonlinedate']; $maxusers[0] = $totalonline; $maxusers[1] = $time; } $todayloggedinusers = ""; $numbertodayonline = 0; $numbertodayonlineinvisible = 0; $todaynumberregistered = 0; $todayusers=$DB_site->query("SELECT userid, username, usergroupid, lastactivity, options FROM ".TABLE_PREFIX."user WHERE lastactivity > " . (mktime(0,0,0,date("m"),date("d"),date("Y")) + (($bbuserinfo['timezoneoffset']-$vboptions[timeoffset])*3600)) . " ORDER BY username"); while ($todayuser=$DB_site->fetch_array($todayusers)) { $todayuser['options'] = intval($todayuser['options']); foreach($_USEROPTIONS AS $optionname => $optionval) { $todayuser["$optionname"] = iif($todayuser['options'] & $optionval, 1, 0); } $todaynumberregistered++; $numbertodayonline++; $invisibleuser = ''; $userid = $todayuser['userid']; $lastactivetime = vbdate($vboptions['timeformat'], $todayuser[lastactivity]); if ($todayuser['invisible']==1 and $bbuserinfo['usergroupid']!=6) { $numbertodayonlineinvisible++; continue; } if ($todayuser['invisible'] == 1) { // Invisible User but show to Admin $invisibleuser = '*'; } $username = fetch_musername($todayuser); if (!$todayloggedinuser) { eval("\$todayloggedinuser = \"".fetch_template('forumhome_todayloggedinuser')."\";"); } else { eval("\$todayloggedinuser .= \", ".fetch_template('forumhome_todayloggedinuser')."\";"); } } $DB_site->free_result($todayusers); if ($bbuserinfo[usergroupid] == 6) { $todayonline = $numbertodayonline; } else { $todayonline = $numbertodayonline - $numbertodayonlineinvisible; } if ((int)$maxusers[2] <= $numbertodayonline) { $time = time(); $maxloggedin = $maxusers[0] . " " . $maxusers[1] . " $numbertodayonline " . $time; $maxusers[2] = $numbertodayonline; $maxusers[3] = $time; } // ### MAX LOGGEDIN USERS TODAY ################################ $todaymaxusers = unserialize($datastore['todaymaxonline']); if (intval($todaymaxusers['todaymaxonline']) <= $todaynumberregistered) { $todaymaxusers['todaymaxonline'] = $todaynumberregistered; $todaymaxusers['todaymaxonlinedate'] = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $DB_site->query("REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) VALUES ('todaymaxonline', '" . addslashes(serialize($todaymaxusers)) . "')"); } $todayrecordusers = $todaymaxusers['todaymaxonline']; $todayrecorddate = vbdate($vboptions['dateformat'], $todaymaxusers['todaymaxonlinedate'], 1); eval("\$todayloggedinusers = \"".fetch_template('forumhome_todayloggedinusers')."\";"); ****************************** OPEN THE FORUMHOME TEMPLATE AND FIND ****************************** ****************************** BELOW, ADD ****************************** $todayloggedinusers ****************************** CREATE 2 NEW TEMPLATES CALLED: forumhome_todayloggedinuser forumhome_todayloggedinusers ****************************** IN forumhome_todayloggedinuser PUT ****************************** $vbphrase[last_online_at_x]">$username$invisibleuser ****************************** IN forumhome_todayloggedinusers PUT ******************************
$vbphrase[active_users_today]: $todayonline