vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin Forum Sideblocks - Block - Users Online (https://vborg.vbsupport.ru/showthread.php?t=233965)

Lynne 01-22-2010 10:00 PM

Block - Users Online
 
1 Attachment(s)
This is a block for your forum sideblocks to show the Current Users Online.

https://vborg.vbsupport.ru/attachmen...1&d=1276355488

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!!!

tini_lam 01-23-2010 03:53 PM

detention

Robru 01-23-2010 05:48 PM

Is this the same mod as the 4.0RC4 mod ? :)

wayne.richards@ 01-23-2010 06:41 PM

Installed! I Like It!

Hornstar 01-23-2010 07:45 PM

Thanks, I might finally change some things around with my skin with this.

Tagged for when I upgrade.

Lynne 01-23-2010 08:13 PM

Quote:

Originally Posted by Robru (Post 1964601)
Is this the same mod as the 4.0RC4 mod ? :)

This is a block, not a widget. I wrote the other one also and just used most of my same code (different template though).

fourat 01-23-2010 09:36 PM

Thank you

DjEddie 01-23-2010 10:47 PM

Hi, Lynne

Ive installed this as per your instructions and double checked and i get the Users Online block .. but no text inside ..

any suggestions ?

Thanks :)

mandingo 01-23-2010 11:31 PM

Quick one Lynne, I tried to add the "most ever users" into it and it didn't seem to work.
I put:
HTML Code:

<p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw recordusers}, {vb:raw recorddate}, {vb:raw recordtime}}</p>
under:
HTML Code:

<p>{vb:rawphrase there_are_x_online, {vb:raw totalonline}}
                <br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw numberregistered}, {vb:raw numberguest}}</span></p>
                <ol class="commalist" id="wgo_onlineusers_list">

I'm assuming I need to put something under:
HTML Code:

$totalonline = $numberregistered + $numberguest;
    $numberinvisible = $numberregistered - $numbervisible;

But i don't know where to look.
$recordusers somehwhere?

JAFRI 01-24-2010 04:21 AM

nice, working it >

Coroner 01-24-2010 06:52 AM

Quote:

Originally Posted by DjEddie (Post 1964833)
Hi, Lynne

Ive installed this as per your instructions and double checked and i get the Users Online block .. but no text inside ..

any suggestions ?

Thanks :)

Template to Use - block_users_online

This works pretty good. Thx @Lynne

DjEddie 01-24-2010 12:14 PM

Quote:

Originally Posted by Coroner (Post 1964996)
Template to Use - block_users_online

This works pretty good. Thx @Lynne

Thanks .. stupidly missed that lol cheers coroner :)

Lynne 01-24-2010 02:47 PM

Quote:

Originally Posted by mandingo (Post 1964847)
Quick one Lynne, I tried to add the "most ever users" into it and it didn't seem to work.

Yes, you would need to add the code from the forum.php page to get that info. Problem is, it is from the datamanager and I know I couldn't grab the datamanager info when I had this code in the widget and I didn't even bother to try for this block. Someone asked me for the code to put the widget in the block and so that's exactly what I did.

marcomrc 01-25-2010 11:47 AM

gives me this error:

Fatal error: Class 'vB' not found in /web/htdocs/www.xxxxxxx.it/home/forum/includes/block/html.php(89) : eval()'d code on line 2

DjEddie 01-25-2010 01:25 PM

Hi, noticed an error that I get from this mod (found it was this by disabling and enabling the different mods i have).

When I log out (with this mod enabled) this is the error I get:

Fatal error: Call to undefined function fetch_online_status() in /home/*****/public_html/radio1/includes/block/html.php(89) : eval()'d code on line 93

line 93 of the includes/block/html.php code is:
Code:

        $content = nl2br(htmlspecialchars_uni($this->config['html_content']));
when the mod is disabled .. this error doesn't happen .. any suggestions?

Lynne 01-25-2010 02:36 PM

Quote:

Originally Posted by marcomrc (Post 1966068)
gives me this error:


Fatal error: Class 'vB' not found in /web/htdocs/www.xxxxxxx.it/home/forum/includes/block/html.php(89) : eval()'d code on line 2

Quote:

Originally Posted by DjEddie (Post 1966137)
Hi, noticed an error that I get from this mod (found it was this by disabling and enabling the different mods i have).

When I log out (with this mod enabled) this is the error I get:

Fatal error: Call to undefined function fetch_online_status() in /home/*****/public_html/radio1/includes/block/html.php(89) : eval()'d code on line 93

line 93 of the includes/block/html.php code is:
Code:

    $content = nl2br(htmlspecialchars_uni($this->config['html_content']));
when the mod is disabled .. this error doesn't happen .. any suggestions?

What version of vB are you guys running? And what browser? I can't reproduce either of these errors on my 4.0.1 test site (either suite or forums only) using either firefox or safari.

DjEddie 01-26-2010 09:02 PM

Quote:

Originally Posted by Lynne (Post 1966184)
What version of vB are you guys running? And what browser? I can't reproduce either of these errors on my 4.0.1 test site (either suite or forums only) using either firefox or safari.

Hi Lynne,

I'm running 4.0.1 and i'm using firefox 3.57 and also Internet explorer 7.06 and have tried uninstalling and reinstalling and still have same error .. not sure why

Lynne 01-26-2010 09:46 PM

Quote:

Originally Posted by DjEddie (Post 1967440)
Hi Lynne,

I'm running 4.0.1 and i'm using firefox 3.57 and also Internet explorer 7.06 and have tried uninstalling and reinstalling and still have same error .. not sure why

This is on the forum.php page, right? If you are using some mod to make it show on other pages, then you need to include the function, and maybe other functions that are in the functions_bigthree.php file.

DjEddie 01-26-2010 10:29 PM

ahh, yes sorry its the "EveryWhere Sidebar" mod that gives it the error when both mods are on ...

im not sure what functions would be needed to be added .. could u explain or should i be asking the developer of that mod?

thanks :)

Lynne 01-26-2010 10:44 PM

Quote:

Originally Posted by DjEddie (Post 1967503)
ahh, yes sorry its the "EveryWhere Sidebar" mod that gives it the error when both mods are on ...

im not sure what functions would be needed to be added .. could u explain or should i be asking the developer of that mod?

thanks :)

Try this.... at the top of the block code, add this line and see if it fixes the issue:

PHP Code:

if (THIS_SCRIPT != 'index') {
require_once(
DIR '/includes/functions_bigthree.php'); 



DjEddie 01-27-2010 09:40 AM

Works perfectly now Lynne.

Thanks for your help :)

cassis2k 01-28-2010 09:13 AM

Thx Lynne :) It works perfectly

buddyheiko 01-28-2010 05:24 PM

Hi,

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

Heiko

starman? 01-29-2010 02:36 PM

Most excellent. Thank you Lynne!

RedTrinity 01-30-2010 12:24 PM

Works great, thank you Lynne :)

captkirk 01-31-2010 12:14 AM

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.

Lynne 01-31-2010 01:22 AM

Quote:

Originally Posted by captkirk (Post 1970900)
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?

benjaminlwells 02-21-2010 09:51 AM

Works great for me. I too would like to have the "most ever" feature available, but that won't keep me up at night ;)

RedTrinity 04-13-2010 02:47 AM

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....

Lynne 04-13-2010 04:41 AM

Quote:

Originally Posted by RedTrinity (Post 2020291)
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..... :) )

starman? 04-13-2010 05:25 AM

Much appreciated Paul & Lynne. Thank you.

RedTrinity 04-14-2010 12:45 AM

Thank you, works again now :)

SmartMania 04-14-2010 12:07 PM

Indeed works again, but doesn't work the pm's system :confused:

Lynne 04-14-2010 02:21 PM

Quote:

Originally Posted by SmartMania (Post 2021085)
Indeed works again, but doesn't work the pm's system :confused:

Huh? This doesn't have anything to do with PMs. :/


Also, just a note about this.... in 4.0.3, they changed the online users list to not show users in usergroups 3 or 4. I didn't update this query to include that. However, if you want it to be the same, you may just open the forum.php file, find the query and you'll see the line to add under the WHERE part of the query. Just add it to the query in the block configuration, like this:

PHP Code:

        WHERE session.lastactivity $datecut
            
AND (user.usergroupid NOT IN (3,4) OR user.usergroupid IS NULL)
            
$hook_query_where 


vexxy 04-15-2010 07:28 PM

works great for 4.0.3...thanks..my only problem is, when I have the block active, the memberlist link (www.site.com/members/list/) gives me an error:

Code:

Fatal error: Call to undefined function fetch_online_status() in /home/bytesin/public_html/includes/block/html.php(95) : eval()'d code on line 94
is there any way I can resolve that? If i disable the sidebar block, it's all good...wierd

COL NIL SATIS 04-18-2010 01:55 PM

spot on Lynne...works brilliantly ,thank you ..installed!!!

COL NIL SATIS 04-30-2010 06:24 PM

what code in 4.0.3 do i remove to take the users online out of the wgo box???? my FORUMHOME template doesnt have

<vb:if condition="$show['loggedinusers']">
<!-- logged-in users -->
{{{code in FORUMHOME template for active users}}}
<!-- end logged-in users -->
</vb:if>

any ideas????

Lynne 04-30-2010 06:54 PM

Well, it doesn't says exactly:
{{{code in FORUMHOME template for active users}}}

I put that in instead of all the code. But it does have the two lines above and below that. If you don't have those lines, you will have to ask the designer of your style where that section is.

COL NIL SATIS 05-01-2010 05:30 PM

Quote:

Originally Posted by Lynne (Post 2029716)
Well, it doesn't says exactly:
{{{code in FORUMHOME template for active users}}}

I put that in instead of all the code. But it does have the two lines above and below that. If you don't have those lines, you will have to ask the designer of your style where that section is.

Okey dokes Lynne ...thanks for the reply :up:

elmstr 05-12-2010 04:54 PM

Sadly, I had to remove the block. Once the block is activated none of the community links on the navbar are working anymore.

They give the same error as describen in post #36.

Any fix for this? Thanks in advance!


All times are GMT. The time now is 04:17 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01491 seconds
  • Memory Usage 1,901KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (3)bbcode_html_printable
  • (3)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete