The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
![]()
OK, I tried to simplify the code from index.php since you only want the counts, but I'm not sure I got it all right (it does say 1 registered and 0 guests when I try it on my test site, so it looks good). Anyway, create a new plugin using hook location misc_start and this code:
Code:
if ($_REQUEST['do'] == 'vbusers') { $datecut = TIMENOW - $vbulletin->options['cookietimeout']; $numberregistered = 0; $numberguest = 0; $forumusers = $vbulletin->db->query_read_slave(" SELECT userid FROM " . TABLE_PREFIX . "session AS session WHERE session.lastactivity > $datecut "); while ($loggedin = $vbulletin->db->fetch_array($forumusers)) { $userid = $loggedin['userid']; if (!$userid) $numberguest++; else $numberregistered++; } unset($loggedin); $vbulletin->db->free_result($forumusers); echo "var number_registered = $numberregistered;\n"; echo "var number_guests = $numberguest;\n"; exit; } Then in the page where you want to display it, put something like this: Code:
<script src="http://my-site.com/forums/misc.php?do=vbusers" type="text/javascript"></script> <script type="text/javascript"> <!-- document.writeln(number_registered + " registered users<br />"); document.writeln(number_guests + " guests<br />"); document.writeln((number_guests + number_registered) + " total vb user(s)<br />"); //--> </script> of course you need to change the url (in red) to your site, and you can change the html in the writeln lines to be whatever you want. |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|