The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Who's Online Sidebar Block Details »» | |||||||||||||||||||||||||||
This is tested and working with Everywhere Sidebar 4 VB4
Step One: Create a Template ACP > Style Manager > Add New Template Title: block_online Code:
<div class="blocksubhead">{vb:rawphrase x_members_and_y_guests, {vb:raw numberregistered}, {vb:raw numberguest}}</div> <div class="blockrow"> <vb:if condition="$activeusers"> <vb:each from="activeusers" value="loggedin"> <a class="username" href="{vb:link member, {vb:raw loggedin}}">{vb:raw loggedin.musername}</a>{vb:raw loggedin.invisiblemark}{vb:raw loggedin.buddymark}, </vb:each> <vb:else /> {vb:rawphrase no_x_online, {vb:rawphrase members}} </vb:if> </div> <div class="blockrow">{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw recordusers}, {vb:raw recorddate}, {vb:raw recordtime}}</div> ACP > Forums & Moderators > Forum Blocks Manager > Add Block Select Block Type: Custom HTML/PHP Title: Online Users Cache Time (in minutes): 5 Active: Yes Content Type: PHP Code:
global $vbulletin; global $db; // space separated list of group ids to filter out $filter_groupids = ""; // members logged into forums $loggedinusers = array(); $activeusers = array(); $invisiblecount = 0; // Logged in user if ($vbulletin->userinfo['userid']) { $loggedinusers[$vbulletin->userinfo['userid']] = array( 'userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'], 'invisiblemark' => ($vbulletin->userinfo['invisible']) ? '*' : '', 'displaygroupid' => $vbulletin->userinfo['displaygroupid'], 'musername' => fetch_musername($vbulletin->userinfo) ); } $getonline = $db->query_read(" SELECT session.userid, username, usergroupid, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, membergroupids FROM " . TABLE_PREFIX . "session AS session LEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid) WHERE session.lastactivity > " . (TIMENOW - $vbulletin->options['cookietimeout']) . " ORDER BY username ASC "); $filter_groupids = explode(" ", $filter_groupids); while ($onlineusers = $db->fetch_array($getonline)) { if (!$onlineusers['userid']) { $numberguest++; } else { if ($onlineusers['invisible']) { if (($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) OR $onlineusers['userid'] == $vbulletin->userinfo['userid']) { $onlineusers['invisiblemark'] = '*'; } else { $invisiblecount++; continue; } } $groupids = array(); array_push($groupids, $onlineusers['usergroupid'], $onlineusers['displaygroupid']); $groupids = array_merge ( $groupids, explode(" ", $onlineusers['membergroupids']) ); foreach($groupids as $value) if(in_array($value, $filter_groupids)) continue; $loggedinusers[$onlineusers['userid']] = $onlineusers; } } $db->free_result($getonline); unset($onlineusers); // ##### Process Online Users Module $numberregistered = sizeof($loggedinusers); $show['comma_leader'] = false; $show['divrow'] = false; if (!empty($loggedinusers)) { foreach ($loggedinusers AS $loggedinuserid => $loggedin) { $loggedin['musername'] = fetch_musername($loggedin); ($hook = vBulletinHook::fetch_hook('vba_cmps_module_onlineuserbits')) ? eval($hook) : false; $activeusers[$loggedinuserid] = $loggedin; } } // Process the total first, before number_format is applied $totalonline = $numberregistered + $numberguest + $invisiblecount; if ($vbulletin->maxloggedin['maxonline'] <= $totalonline) { $vbulletin->maxloggedin['maxonline'] = $totalonline; $vbulletin->maxloggedin['maxonlinedate'] = TIMENOW; build_datastore('maxloggedin', serialize($vbulletin->maxloggedin), 1); } $totalonline = vb_number_format($totalonline); $numberregistered = vb_number_format($numberregistered + $invisiblecount); $numberguest = vb_number_format($numberguest); $recordusers = vb_number_format($vbulletin->maxloggedin['maxonline']); $recorddate = vbdate($vbulletin->options['dateformat'], $vbulletin->maxloggedin['maxonlinedate'], 1); $recordtime = vbdate($vbulletin->options['timeformat'], $vbulletin->maxloggedin['maxonlinedate']); // print everything $templater = vB_Template::create('block_online'); $templater->register('activeusers', $activeusers); $templater->register('altbgclass', $altbgclass); $templater->register('bgclass', $bgclass); $templater->register('numberguest', $numberguest); $templater->register('numberregistered', $numberregistered); $templater->register('recorddate', $recorddate); $templater->register('recordtime', $recordtime); $templater->register('recordusers', $recordusers); $content = $templater->render(); unset($loggedinusers, $activeusers); return $content; $filter_groupids = "(insert numbers here)"; Enjoy. Screenshots
Show Your Support
|
Благодарность от: | ||
Rodrigo. |
Comments |
#2
|
|||
|
|||
Installed. Anyway to turn off showing who is online? I have over 750 members logged in so it makes my sidebar go down a long way....
|
#3
|
||||
|
||||
<a href="https://vborg.vbsupport.ru/showthread.php?t=233965" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=233965</a> ?
|
#5
|
||||
|
||||
I will test it
I will try to block lateral statistics I want to have a sidebar similar to xenforo ^ ^ |
#6
|
|||
|
|||
Prove what? There's a screenshot and installs, it works.
Done trolling now ? |
#7
|
||||
|
||||
A cms block would be cool too! Thanks and nominated/rated!
|
#9
|
|||
|
|||
Installed
|
#10
|
|||
|
|||
Quote:
Replace your block content entirely with this, then add your usergroup numbers to: // space separated list of group ids to filter out $filter_groupids = ""; Code:
global $vbulletin; global $db; // space separated list of group ids to filter out $filter_groupids = ""; // members logged into forums $loggedinusers = array(); $activeusers = array(); $invisiblecount = 0; // Logged in user if ($vbulletin->userinfo['userid']) { $loggedinusers[$vbulletin->userinfo['userid']] = array( 'userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'], 'invisiblemark' => ($vbulletin->userinfo['invisible']) ? '*' : '', 'displaygroupid' => $vbulletin->userinfo['displaygroupid'], 'musername' => fetch_musername($vbulletin->userinfo) ); } $getonline = $db->query_read(" SELECT session.userid, username, usergroupid, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, membergroupids FROM " . TABLE_PREFIX . "session AS session LEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid) WHERE session.lastactivity > " . (TIMENOW - $vbulletin->options['cookietimeout']) . " ORDER BY username ASC "); $filter_groupids = explode(" ", $filter_groupids); while ($onlineusers = $db->fetch_array($getonline)) { if (!$onlineusers['userid']) { $numberguest++; } else { if ($onlineusers['invisible']) { if (($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) OR $onlineusers['userid'] == $vbulletin->userinfo['userid']) { $onlineusers['invisiblemark'] = '*'; } else { $invisiblecount++; continue; } } $groupids = array(); array_push($groupids, $onlineusers['usergroupid'], $onlineusers['displaygroupid']); $groupids = array_merge ( $groupids, explode(" ", $onlineusers['membergroupids']) ); foreach($groupids as $value) if(in_array($value, $filter_groupids)) continue; $loggedinusers[$onlineusers['userid']] = $onlineusers; } } $db->free_result($getonline); unset($onlineusers); // ##### Process Online Users Module $numberregistered = sizeof($loggedinusers); $show['comma_leader'] = false; $show['divrow'] = false; if (!empty($loggedinusers)) { foreach ($loggedinusers AS $loggedinuserid => $loggedin) { $loggedin['musername'] = fetch_musername($loggedin); ($hook = vBulletinHook::fetch_hook('vba_cmps_module_onlineuserbits')) ? eval($hook) : false; $activeusers[$loggedinuserid] = $loggedin; } } // Process the total first, before number_format is applied $totalonline = $numberregistered + $numberguest + $invisiblecount; if ($vbulletin->maxloggedin['maxonline'] <= $totalonline) { $vbulletin->maxloggedin['maxonline'] = $totalonline; $vbulletin->maxloggedin['maxonlinedate'] = TIMENOW; build_datastore('maxloggedin', serialize($vbulletin->maxloggedin), 1); } $totalonline = vb_number_format($totalonline); $numberregistered = vb_number_format($numberregistered + $invisiblecount); $numberguest = vb_number_format($numberguest); $recordusers = vb_number_format($vbulletin->maxloggedin['maxonline']); $recorddate = vbdate($vbulletin->options['dateformat'], $vbulletin->maxloggedin['maxonlinedate'], 1); $recordtime = vbdate($vbulletin->options['timeformat'], $vbulletin->maxloggedin['maxonlinedate']); // print everything $templater = vB_Template::create('block_online'); $templater->register('activeusers', $activeusers); $templater->register('altbgclass', $altbgclass); $templater->register('bgclass', $bgclass); $templater->register('numberguest', $numberguest); $templater->register('numberregistered', $numberregistered); $templater->register('recorddate', $recorddate); $templater->register('recordtime', $recordtime); $templater->register('recordusers', $recordusers); $content = $templater->render(); unset($loggedinusers, $activeusers); return $content; |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|