The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
$totalonline, $numbervisible, $numberguests in navbar?
I added the code in red to my navbar template:
Code:
<strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong><br /> $vbphrase[currently_active_users]: $totalonline (<phrase 1="$numbervisible" 2="$numberguests">$vbphrase[x_members_and_y_guests]</phrase>)<br /> But when I view the page, it shows up as follows: Online Users: 217 ( members and guests) - notice it's not getting the values for members and guests. What else do I need to add to display those values? Thanks for the help guys. |
#2
|
||||
|
||||
You would need to add a plugin that then has the code that creates those variables for you. The code is on the bottom of the index.php page (if I recall correctly).
|
#3
|
|||
|
|||
Thanks for the help, Lynne. I'm confused. I tried creating a new plugin with a hook location of global_start and the following code...
Code:
$activeusers = ''; if (($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 2 OR ($vbulletin->options['displayloggedin'] > 2 AND $vbulletin->userinfo['userid'])) AND !$show['search_engine']) { $datecut = TIMENOW - $vbulletin->options['cookietimeout']; $numbervisible = 0; $numberregistered = 0; $numberguest = 0; $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('forumhome_loggedinuser_query')) ? eval($hook) : false; $forumusers = $db->query_read_slave(" SELECT user.username, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, user.usergroupid, session.userid, session.inforum, session.lastactivity, session.badlocation, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid $hook_query_fields FROM " . TABLE_PREFIX . "session AS session LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid) $hook_query_joins WHERE session.lastactivity > $datecut $hook_query_where " . iif($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 3, "ORDER BY username ASC") . " "); if ($vbulletin->userinfo['userid']) { // fakes the user being online for an initial page view of index.php $vbulletin->userinfo['joingroupid'] = iif($vbulletin->userinfo['displaygroupid'], $vbulletin->userinfo['displaygroupid'], $vbulletin->userinfo['usergroupid']); $userinfos = array ( $vbulletin->userinfo['userid'] => array ( 'userid' =>& $vbulletin->userinfo['userid'], 'username' =>& $vbulletin->userinfo['username'], 'invisible' =>& $vbulletin->userinfo['invisible'], 'inforum' => 0, 'lastactivity' => TIMENOW, 'usergroupid' =>& $vbulletin->userinfo['usergroupid'], 'displaygroupid' =>& $vbulletin->userinfo['displaygroupid'], 'infractiongroupid' =>& $vbulletin->userinfo['infractiongroupid'], ) ); } else { $userinfos = array(); } $inforum = array(); while ($loggedin = $db->fetch_array($forumusers)) { $userid = $loggedin['userid']; if (!$userid) { // Guest $numberguest++; if (!$loggedin['badlocation']) { $inforum["$loggedin[inforum]"]++; } } else if (empty($userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity'])) { $userinfos["$userid"] = $loggedin; } } if (!$vbulletin->userinfo['userid'] AND $numberguest == 0) { $numberguest++; } foreach ($userinfos AS $userid => $loggedin) { $numberregistered++; if ($userid != $vbulletin->userinfo['userid'] AND !$loggedin['badlocation']) { $inforum["$loggedin[inforum]"]++; } fetch_musername($loggedin); ($hook = vBulletinHook::fetch_hook('forumhome_loggedinuser')) ? eval($hook) : false; if (fetch_online_status($loggedin)) { $numbervisible++; $show['comma_leader'] = ($activeusers != ''); eval('$activeusers .= "' . fetch_template('forumhome_loggedinuser') . '";'); } } // memory saving unset($userinfos, $loggedin); $db->free_result($forumusers); $totalonline = $numberregistered + $numberguest; $numberinvisible = $numberregistered - $numbervisible; // ### MAX LOGGEDIN USERS ################################ if (intval($vbulletin->maxloggedin['maxonline']) <= $totalonline) { $vbulletin->maxloggedin['maxonline'] = $totalonline; $vbulletin->maxloggedin['maxonlinedate'] = TIMENOW; build_datastore('maxloggedin', serialize($vbulletin->maxloggedin), 1); } $recordusers = vb_number_format($vbulletin->maxloggedin['maxonline']); $recorddate = vbdate($vbulletin->options['dateformat'], $vbulletin->maxloggedin['maxonlinedate'], true); $recordtime = vbdate($vbulletin->options['timeformat'], $vbulletin->maxloggedin['maxonlinedate']); $show['loggedinusers'] = true; } else { $show['loggedinusers'] = false; } ...but it didn't work. No doubt I don't quite understand plugins well enough, but I'm learning! |
#4
|
||||
|
||||
I hope you didn't do that on a live site cuz my guess is you have zapped your max logged in users now.
The best thing you can do is start troubleshooting it by spiting out variables and see exactly what is going through there. Do you know if your code went through the if or else path? Find that out first. Then start doing other little things to find exactly what is going on. |
#5
|
|||
|
|||
Uh oh, zapping sounds bad. Site works fine, though. :shrug: Here's an excerpt from my navbar template, looks like it's going through the if path? If that's what you mean.
Code:
<if condition="$show['member']"> <td class="alt2" nowrap="nowrap"> <div class="smallfont"> <strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong><br /> $vbphrase[currently_active_users]: $totalonline (<phrase 1="$numbervisible" 2="$numberguests">$vbphrase[x_members_and_y_guests]</phrase>)<br /> <if condition="$show['notifications']"> <div> <if condition="$bbuserinfo['pmunread']"> <a href="http://www.truestreetcars.com/forums/private.php?"><img border="0" src="/forums/images/misc/newpm.gif" width="22" height="10"></a> </if> I found this post on vbulletin.com. Would this accomplish what I'm trying to do? For example would I be able to paste this code... Code:
$db->free_result($forumusers); $totalonline = $numberregistered + $numberguest; $numberinvisible = $numberregistered - $numbervisible; // ### MAX LOGGEDIN USERS ################################ if (intval($vbulletin->maxloggedin['maxonline']) <= $totalonline) { $vbulletin->maxloggedin['maxonline'] = $totalonline; $vbulletin->maxloggedin['maxonlinedate'] = TIMENOW; build_datastore('maxloggedin', serialize($vbulletin->maxloggedin), 1); } $recordusers = vb_number_format($vbulletin->maxloggedin['maxonline']); $recorddate = vbdate($vbulletin->options['dateformat'], $vbulletin->maxloggedin['maxonlinedate'], true); $recordtime = vbdate($vbulletin->options['timeformat'], $vbulletin->maxloggedin['maxonlinedate']); $show['loggedinusers'] = true; } ...somewhere in global.php? Usually I can figure these things out pretty quickly but this one is proving elusive. I must be missing something. LOL |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|