The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Users online (Page specific)
Hi, Im looking for a mod that will display users online on a certain page. This is a VB powered page. I tried adding the the $activeusers, like on forumdisplay template, but that didnt do it.
Any help wuld be great, thanks. |
#2
|
|||
|
|||
I actually tried to do this yesterday, too. Anyone have any experience with this?
I basically want to show everyone currently logged into the forum, just like $activeusers on the front page-- but on every page of the forums. |
#3
|
|||
|
|||
Quote:
This add the Who's Online bar below the navbar This hack is definetly not recommmended for busy forums as it adds two queries to everypage, and a long list of names at the top of the page would look messy also.. in INDEX.PHP find and REMOVE: Code:
// ### LOGGED IN USERS ################################################# $activeusers = ''; if ($vboptions['displayloggedin']) { $datecut = TIMENOW - $vboptions['cookietimeout']; $numbervisible = 0; $numberregistered = 0; $numberguest = 0; $forumusers = $DB_site->query(" SELECT user.username, (user.options & $_USEROPTIONS[invisible]) AS invisible, user.usergroupid, session.userid, session.inforum, session.lastactivity, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "session AS session LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid) WHERE session.lastactivity > $datecut " . iif($vboptions['displayloggedin'] == 1, "ORDER BY username ASC") . " "); if ($bbuserinfo['userid']) { // fakes the user being online for an initial page view of index.php $bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']); $userinfos = array ( $bbuserinfo['userid'] => array ( 'userid' => $bbuserinfo['userid'], 'username' => $bbuserinfo['username'], 'invisible' => $bbuserinfo['invisible'], 'inforum' => 0, 'lastactivity' => TIMENOW, 'usergroupid' => $bbuserinfo['usergroupid'], 'displaygroupid' => $bbuserinfo['displaygroupid'], ) ); } else { $userinfos = array(); } $inforum = array(); while ($loggedin = $DB_site->fetch_array($forumusers)) { $userid = $loggedin['userid']; if (!$userid) { // Guest $numberguest++; $inforum["$loggedin[inforum]"]++; } else if (empty($userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity'])) { $userinfos["$userid"] = $loggedin; } } foreach($userinfos AS $userid => $loggedin) { $numberregistered++; if ($userid != $bbuserinfo['userid']) { $inforum["$loggedin[inforum]"]++; } $loggedin['musername'] = fetch_musername($loggedin); if (fetch_online_status($loggedin)) { $numbervisible++; eval('$activeusers .= ", ' . fetch_template('forumhome_loggedinuser') . '";'); } } // memory saving unset($userinfos, $loggedin); $activeusers = substr($activeusers , 2); // get rid of initial comma $DB_site->free_result($loggedins); $totalonline = $numberregistered + $numberguest; $numberinvisible = $numberregistered - $numbervisible; // ### MAX LOGGEDIN USERS ################################ $maxusers = unserialize($datastore['maxloggedin']); if (intval($maxusers['maxonline']) <= $totalonline) { $maxusers['maxonline'] = $totalonline; $maxusers['maxonlinedate'] = TIMENOW; build_datastore('maxloggedin', serialize($maxusers)); } $recordusers = $maxusers['maxonline']; $recorddate = vbdate($vboptions['dateformat'], $maxusers['maxonlinedate'], true); $recordtime = vbdate($vboptions['timeformat'], $maxusers['maxonlinedate']); $show['loggedinusers'] = true; } else { $show['loggedinusers'] = false; } Code:
// ###################### Start getOnlineStatus ####################### // work out if bbuser can see online status of user // also puts in + and * symbols as $user[buddymark] and $user[invisiblemark] function fetch_online_status(&$user, $setstatusimage = false) { global $bbuserinfo, $permissions, $vboptions, $stylevar, $vbphrase; static $buddylist, $datecut; // get variables used by this function if (!is_array($buddylist)) { $datecut = TIMENOW - $vboptions['cookietimeout']; if ($bbuserinfo['buddylist'] = trim($bbuserinfo['buddylist'])) { $buddylist = preg_split('/\s+/', $bbuserinfo['buddylist'], -1, PREG_SPLIT_NO_EMPTY); } else { $buddylist = array(); } } // is the user on bbuser's buddylist? if (in_array($user['userid'], $buddylist)) { $user['buddymark'] = '+'; } else { $user['buddymark'] = ''; } // set the invisible mark to nothing by default $user['invisiblemark'] = ''; $onlinestatus = 0; // now decide if we can see the user or not if ($user['lastactivity'] > $datecut AND $user['lastvisit'] != $user['lastactivity']) { if ($user['invisible']) { if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $user['userid'] == $bbuserinfo['userid']) { // user is online and invisible BUT bbuser can see them $user['invisiblemark'] = '*'; $onlinestatus = 2; } } else { // user is online and visible $onlinestatus = 1; } } if ($setstatusimage) { eval('$user[\'onlinestatus\'] = "' . fetch_template('postbit_onlinestatus') . '";'); } return $onlinestatus; } Code:
'phpinclude_start', Code:
'forumhome_loggedinuser', Code:
// ### LOGGED IN USERS ################################################# $activeusers = ''; if ($vboptions['displayloggedin']) { $datecut = TIMENOW - $vboptions['cookietimeout']; $numbervisible = 0; $numberregistered = 0; $numberguest = 0; $forumusers = $DB_site->query(" SELECT user.username, (user.options & $_USEROPTIONS[invisible]) AS invisible, user.usergroupid, session.userid, session.inforum, session.lastactivity, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "session AS session LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid) WHERE session.lastactivity > $datecut " . iif($vboptions['displayloggedin'] == 1, "ORDER BY username ASC") . " "); if ($bbuserinfo['userid']) { // fakes the user being online for an initial page view of index.php $bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']); $userinfos = array ( $bbuserinfo['userid'] => array ( 'userid' => $bbuserinfo['userid'], 'username' => $bbuserinfo['username'], 'invisible' => $bbuserinfo['invisible'], 'inforum' => 0, 'lastactivity' => TIMENOW, 'usergroupid' => $bbuserinfo['usergroupid'], 'displaygroupid' => $bbuserinfo['displaygroupid'], ) ); } else { $userinfos = array(); } $inforum = array(); while ($loggedin = $DB_site->fetch_array($forumusers)) { $userid = $loggedin['userid']; if (!$userid) { // Guest $numberguest++; $inforum["$loggedin[inforum]"]++; } else if (empty($userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity'])) { $userinfos["$userid"] = $loggedin; } } foreach($userinfos AS $userid => $loggedin) { $numberregistered++; if ($userid != $bbuserinfo['userid']) { $inforum["$loggedin[inforum]"]++; } $loggedin['musername'] = fetch_musername($loggedin); if (fetch_online_status($loggedin)) { $numbervisible++; eval('$activeusers .= ", ' . fetch_template('forumhome_loggedinuser') . '";'); } } // memory saving unset($userinfos, $loggedin); $activeusers = substr($activeusers , 2); // get rid of initial comma $DB_site->free_result($loggedins); $totalonline = $numberregistered + $numberguest; $numberinvisible = $numberregistered - $numbervisible; // ### MAX LOGGEDIN USERS ################################ $maxusers = unserialize($datastore['maxloggedin']); if (intval($maxusers['maxonline']) <= $totalonline) { $maxusers['maxonline'] = $totalonline; $maxusers['maxonlinedate'] = TIMENOW; build_datastore('maxloggedin', serialize($maxusers)); } $recordusers = $maxusers['maxonline']; $recorddate = vbdate($vboptions['dateformat'], $maxusers['maxonlinedate'], true); $recordtime = vbdate($vboptions['timeformat'], $maxusers['maxonlinedate']); $show['loggedinusers'] = true; } else { $show['loggedinusers'] = false; } // ###################### Start getOnlineStatus ####################### // work out if bbuser can see online status of user // also puts in + and * symbols as $user[buddymark] and $user[invisiblemark] function fetch_online_status(&$user, $setstatusimage = false) { global $bbuserinfo, $permissions, $vboptions, $stylevar, $vbphrase; static $buddylist, $datecut; // get variables used by this function if (!is_array($buddylist)) { $datecut = TIMENOW - $vboptions['cookietimeout']; if ($bbuserinfo['buddylist'] = trim($bbuserinfo['buddylist'])) { $buddylist = preg_split('/\s+/', $bbuserinfo['buddylist'], -1, PREG_SPLIT_NO_EMPTY); } else { $buddylist = array(); } } // is the user on bbuser's buddylist? if (in_array($user['userid'], $buddylist)) { $user['buddymark'] = '+'; } else { $user['buddymark'] = ''; } // set the invisible mark to nothing by default $user['invisiblemark'] = ''; $onlinestatus = 0; // now decide if we can see the user or not if ($user['lastactivity'] > $datecut AND $user['lastvisit'] != $user['lastactivity']) { if ($user['invisible']) { if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $user['userid'] == $bbuserinfo['userid']) { // user is online and invisible BUT bbuser can see them $user['invisiblemark'] = '*'; $onlinestatus = 2; } } else { // user is online and visible $onlinestatus = 1; } } if ($setstatusimage) { eval('$user[\'onlinestatus\'] = "' . fetch_template('postbit_onlinestatus') . '";'); } return $onlinestatus; } Code:
</table> </div> <!-- / nav buttons bar --> Code:
<tr><td class="tcat" colspan="8" align="left"><div title="Members: $numberregistered | Guests: $numberguest | <phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase>"><a href="online.php?">Who's Online:</a> $activeusers</div></td></tr> Code:
<if condition="$show['loggedinusers']"> <!-- logged-in users --> <tbody> <tr> <td class="thead" colspan="2"> <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a> <a href="online.php?$session[sessionurl]">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>) </td> </tr> </tbody> <tbody id="collapseobj_forumhome_activeusers" style="$vbcollapse[collapseobj_forumhome_activeusers]"> <tr> <td class="alt2"><a href="online.php?$session[sessionurl]"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="$vbphrase[view_whos_online]" border="0" /></a></td> <td class="alt1" width="100%"> <div class="smallfont"> <div style="white-space: nowrap"><phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div> <div>$activeusers</div> </div> </td> </tr> </tbody> <!-- end logged-in users --> </if> |
#4
|
|||
|
|||
Quote:
Code:
// ### LOGGED IN USERS ################################################# $activeusers = ''; if ($vboptions['displayloggedin']) { $datecut = TIMENOW - $vboptions['cookietimeout']; $numbervisible = 0; $numberregistered = 0; $numberguest = 0; $forumusers = $DB_site->query(" SELECT user.username, (user.options & $_USEROPTIONS[invisible]) AS invisible, user.usergroupid, session.userid, session.inforum, session.lastactivity, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "session AS session LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid) WHERE session.lastactivity > $datecut " . iif($vboptions['displayloggedin'] == 1, "ORDER BY username ASC") . " "); if ($bbuserinfo['userid']) { // fakes the user being online for an initial page view of index.php $bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']); $userinfos = array ( $bbuserinfo['userid'] => array ( 'userid' => $bbuserinfo['userid'], 'username' => $bbuserinfo['username'], 'invisible' => $bbuserinfo['invisible'], 'inforum' => 0, 'lastactivity' => TIMENOW, 'usergroupid' => $bbuserinfo['usergroupid'], 'displaygroupid' => $bbuserinfo['displaygroupid'], ) ); } else { $userinfos = array(); } $inforum = array(); while ($loggedin = $DB_site->fetch_array($forumusers)) { $userid = $loggedin['userid']; if (!$userid) { // Guest $numberguest++; $inforum["$loggedin[inforum]"]++; } else if (empty($userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity'])) { $userinfos["$userid"] = $loggedin; } } foreach($userinfos AS $userid => $loggedin) { $numberregistered++; if ($userid != $bbuserinfo['userid']) { $inforum["$loggedin[inforum]"]++; } $loggedin['musername'] = fetch_musername($loggedin); if (fetch_online_status($loggedin)) { $numbervisible++; eval('$activeusers .= ", ' . fetch_template('forumhome_loggedinuser') . '";'); } } // memory saving unset($userinfos, $loggedin); $activeusers = substr($activeusers , 2); // get rid of initial comma $DB_site->free_result($loggedins); $totalonline = $numberregistered + $numberguest; $numberinvisible = $numberregistered - $numbervisible; // ### MAX LOGGEDIN USERS ################################ $maxusers = unserialize($datastore['maxloggedin']); if (intval($maxusers['maxonline']) <= $totalonline) { $maxusers['maxonline'] = $totalonline; $maxusers['maxonlinedate'] = TIMENOW; build_datastore('maxloggedin', serialize($maxusers)); } $recordusers = $maxusers['maxonline']; $recorddate = vbdate($vboptions['dateformat'], $maxusers['maxonlinedate'], true); $recordtime = vbdate($vboptions['timeformat'], $maxusers['maxonlinedate']); $show['loggedinusers'] = true; } else { $show['loggedinusers'] = false; } |
#5
|
|||
|
|||
I tried that in the arcade, it gives me a parse error with call to unspecified function for: (fetch_online_status ....
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|