Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Block - Users Online Details »»
Block - Users Online
Version: 1.4, by Lynne Lynne is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: vBulletin Forum Sideblocks - Version: 4.2.0 Rating:
Released: 01-22-2010 Last Update: 06-04-2012 Installs: 161
Uses Plugins Template Edits
Re-useable Code  
No support by the author.

This is a block for your forum sideblocks to show the Current Users Online.



You will need to Create a new Template (block_users_online), Cache the template, Create a new Block (Users Online), and then, optionally, remove the Currently Active Users list from the bottom of the page.

1.1 2010-06-12: Added in Most users ever online. Updated for 4.0.3.
1.2 2010-06-23: Updated to work for 4.0.4.
1.3 2011-11-17: Fixed template and block code for use in 4.1.8.
1.4 2012-06-05: Fixed template for use in 4.2.0.

Installation instructions for 4.2.0, 4.1.8 and pre-4.1.8 are included in the 1.4 download. Please make sure you use the correct Installation Instructions as both the block code and the template code are different depending on the version you are running. Read them carefully!!!

Download Now

File Type: zip Block - Users Online 1.4.zip (26.6 KB, 552 views)

Screenshots

File Type: png block-users online.png (21.5 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
BCP Hung

Comments
  #22  
Old 01-27-2010, 09:40 AM
DjEddie DjEddie is offline
 
Join Date: Nov 2007
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works perfectly now Lynne.

Thanks for your help
Reply With Quote
  #23  
Old 01-28-2010, 09:13 AM
cassis2k cassis2k is offline
 
Join Date: Mar 2005
Location: Paris
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thx Lynne It works perfectly
Reply With Quote
  #24  
Old 01-28-2010, 05:24 PM
buddyheiko buddyheiko is offline
 
Join Date: Apr 2008
Location: Germany, 70771 Leinfelden
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

it works perfect ...
and nothing to translate. Great !

Heiko
Reply With Quote
  #25  
Old 01-29-2010, 02:36 PM
starman? starman? is offline
 
Join Date: Apr 2008
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Most excellent. Thank you Lynne!
Reply With Quote
  #26  
Old 01-30-2010, 12:24 PM
RedTrinity's Avatar
RedTrinity RedTrinity is offline
 
Join Date: Mar 2008
Location: QLD, Australia
Posts: 265
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works great, thank you Lynne
Reply With Quote
  #27  
Old 01-31-2010, 12:14 AM
captkirk captkirk is offline
 
Join Date: Dec 2009
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed correctly but notice it shows only me online when the bottom one shows members as well who are online. I'm pretty sure its a caching issue will further investigate.
Reply With Quote
  #28  
Old 01-31-2010, 01:22 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by captkirk View Post
Installed correctly but notice it shows only me online when the bottom one shows members as well who are online. I'm pretty sure its a caching issue will further investigate.
Did you change the cache time for the block like I suggested in the post?
Reply With Quote
  #29  
Old 02-21-2010, 09:51 AM
benjaminlwells's Avatar
benjaminlwells benjaminlwells is offline
 
Join Date: Jan 2010
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works great for me. I too would like to have the "most ever" feature available, but that won't keep me up at night
Reply With Quote
  #30  
Old 04-13-2010, 02:47 AM
RedTrinity's Avatar
RedTrinity RedTrinity is offline
 
Join Date: Mar 2008
Location: QLD, Australia
Posts: 265
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just upgraded to 4.0.3 and this block stopped working. Completely disappeared But all the plugin/template data for it is still present....
Reply With Quote
  #31  
Old 04-13-2010, 04:41 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RedTrinity View Post
I just upgraded to 4.0.3 and this block stopped working. Completely disappeared But all the plugin/template data for it is still present....
sigh..... no more vB::, back to $vbulletin....

Use this for the code in the block:
PHP Code:
global $vbulletin;
$activeusers '';
if ((
$vbulletin->options['displayloggedin'] == OR $vbulletin->options['displayloggedin'] == OR ($vbulletin->options['displayloggedin'] > 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 $vbulletin->db->query_read_slave("
        SELECT
            user.username, (user.options & " 
$vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, user.usergroupid, user.lastvisit,
            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'] == 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,
                
'lastvisit'         =>& $vbulletin->userinfo['lastvisit'],
                
'usergroupid'       =>& $vbulletin->userinfo['usergroupid'],
                
'displaygroupid'    =>& $vbulletin->userinfo['displaygroupid'],
                
'infractiongroupid' =>& $vbulletin->userinfo['infractiongroupid'],
            )
        );
    }
    else
    {
        
$userinfos = array();
    }
    
$inforum = array();

    while (
$loggedin $vbulletin->db->fetch_array($forumusers))
    {
        
$userid $loggedin['userid'];
        if (!
$userid)
        {    
// Guest
            
$numberguest++;
            if (!isset(
$inforum["$loggedin[inforum]"]))
            {
                
$inforum["$loggedin[inforum]"] = 0;
            }
            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'])
        {
            if (!isset(
$inforum["$loggedin[inforum]"]))
            {
                
$inforum["$loggedin[inforum]"] = 0;
            }
            
$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 != '');
            
$templater vB_Template::create('forumhome_loggedinuser');
                
$templater->register('loggedin'$loggedin);
            
$activeusers .= $templater->render();
            
vB_Template::preRegister('block_users_online', array('activeusers' => $activeusers)); 
        }
    }

    
// memory saving
    
unset($userinfos$loggedin);

    
$vbulletin->db->free_result($forumusers);

    
$totalonline $numberregistered $numberguest;
    
$numberinvisible $numberregistered $numbervisible;

    
$show['loggedinusers'] = true;
    
    
$statsarray = array('onlinestats' => $onlinestats,
    
'totalonline' => $totalonline,
    
'numberregistered' => $numberregistered,
    
'numberguest' => $numberguest,
    
'show'    => $show,
    );
    
    
vB_Template::preRegister('block_users_online'$statsarray); 
    return 
true;

(Thanks go to Paul M. who doesn't know I cheated and just looked to see what he changed..... )
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:51 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05102 seconds
  • Memory Usage 2,399KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete