Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
Who's online on top of forumhome and forumdisplay Details »»
Who's online on top of forumhome and forumdisplay
Version: 1.00, by ericgtr ericgtr is offline
Developer Last Online: Feb 2022 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 02-06-2005 Last Update: Never Installs: 3
Is in Beta Stage  
No support by the author.

This was requested here https://vborg.vbsupport.ru/showthread.php?t=75809

What it does:
Moves the What's going on box from the bottom to the top on the index page. It also duplicates the Who's online portion and places it at the top of the forumdisplay.

In this template we are simply re-arranging the code to move it from the bottom to the top.

In the FORUMHOME template find everything between these two statements:
PHP Code:
<!-- what's going on box -->

<!-- end what'
s going on box --> 
Example:
PHP Code:
<!-- what's going on box -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<thead>
    <tr>
        <td class="tcat" colspan="2">$vbphrase[whats_going_on]</td>
    </tr>
</thead>
<if condition="$show['
loggedinusers']">
<!-- logged-in users -->
<tbody>
    <tr>
        <td class="thead" colspan="2">
            <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('
forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
            <a href="online.php?$session[sessionurl]">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
        </td>
    </tr>
</tbody>
<tbody id="collapseobj_forumhome_activeusers" style="$vbcollapse[collapseobj_forumhome_activeusers]">
    <tr>
        <td class="alt2"><a href="online.php?$session[sessionurl]"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="$vbphrase[view_whos_online]" border="0" /></a></td>
        <td class="alt1" width="100%">
            <div class="smallfont">
                <div style="white-space: nowrap"><phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div>
                <div>$activeusers</div>
            </div>
        </td>
    </tr>
</tbody>
<!-- end logged-in users -->
</if>
<tbody>
    <tr>
        <td class="thead" colspan="2">
            <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('
forumhome_stats')"><img id="collapseimg_forumhome_stats" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_stats].gif" alt="" border="0" /></a>
            <phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>
        </td>
    </tr>
</tbody>
<tbody id="collapseobj_forumhome_stats" style="$vbcollapse[collapseobj_forumhome_stats]">
    <tr>
        <td class="alt2"><img src="$stylevar[imgdir_misc]/stats.gif" alt="<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>" border="0" /></td>
        <td class="alt1" width="100%">
        <div class="smallfont">
            <div>$vbphrase[threads]: $totalthreads, $vbphrase[posts]: $totalposts, $vbphrase[members]: $numbermembers</div>
            <div><phrase 1="member.php?$session[sessionurl]u=$newuserid" 2="$newusername">$vbphrase[welcome_to_our_newest_member_x]</phrase></div>
        </div>
        </td>
    </tr>
</tbody>
<if condition="$show['
birthdays']">
<!-- today'
s birthdays -->
<
tbody>
    <
tr>
        <
td class="thead" colspan="2">
            <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('forumhome_birthdays')"><img id="collapseimg_forumhome_birthdays" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_birthdays].gif" alt="" border="0" /></a>
            
$vbphrase[todays_birthdays]
        </
td>
    </
tr>
</
tbody>
<
tbody id="collapseobj_forumhome_birthdays" style="$vbcollapse[collapseobj_forumhome_birthdays]">
    <
tr>
        <
td class="alt2"><a href="calendar.php?$session[sessionurl]do=getday&amp;day=$today&amp;sb=1"><img src="$stylevar[imgdir_misc]/birthday.gif" alt="$vbphrase[view_birthdays]border="0" /></a></td>
        <
td class="alt1" width="100%"><div class="smallfont">$birthdays</div></td>
    </
tr>
</
tbody>
<!-- 
end today's birthdays -->
</if>
<if condition="$show['
upcomingevents']">
<tbody>
    <tr>
        <td class="thead" colspan="2">
            <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('
forumhome_events')"><img id="collapseimg_forumhome_events" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_events].gif" alt="" border="0" /></a>
            <if condition="$show['
todaysevents']">$vbphrase[todays_events]<else /><phrase 1="$vboptions[showevents]">$vbphrase[upcoming_events_for_the_next_x_days]</phrase></if>
        </td>
    </tr>
</tbody>
<tbody id="collapseobj_forumhome_events" style="$vbcollapse[collapseobj_forumhome_events]">
    <tr>
        <td class="alt2"><a href="calendar.php?$session[sessionurl]"><img src="$stylevar[imgdir_misc]/calendar.gif" alt="$vbphrase[calendar]" border="0" /></a></td>
        <td class="alt1" width="100%"><div class="smallfont">$upcomingevents</div></td>
    </tr>
</tbody>
</if>
</table>
<br />
<!-- end what'
s going on box --> 
Cut the above and past it just below this:

PHP Code:
$header
$navbar 
================================================== ========
================================================== ========

In your forumdisplay template find:

PHP Code:
$header
$navbar 
Add this just below:

PHP Code:
<!-- logged-in users mod -->
<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center">
<
thead>
<if 
condition="$show['loggedinusers']">
<!-- 
logged-in users -->
<
tbody>
    <
tr>
        <
td class="thead" colspan="2">
            <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
            <
a href="online.php?$session[sessionurl]">$vbphrase[currently_active_users]</a>: $totalonline1 (<phrase 1="$numberregistered12="$numberguest1">$vbphrase[x_members_and_y_guests]</phrase>)
        </
td>
    </
tr>
</
tbody>
<
tbody id="collapseobj_forumhome_activeusers" style="$vbcollapse[collapseobj_forumhome_activeusers]">
    <
tr>
        <
td class="alt2"><a href="online.php?$session[sessionurl]"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="$vbphrase[view_whos_online]border="0" /></a></td>
        <
td class="alt1" width="100%">
            <
div class="smallfont">
                <
div style="white-space: nowrap"><phrase 1="$recordusers2="$recorddate3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div>
                <
div>$activeusers1</div>
            </
div>
        </
td>
    </
tr>
</
tbody>
<!-- 
end logged-in users mod -->
</if> 
================================================== ========
================================================== ========

In your forumdisplay.php find:

PHP Code:
// ### BUILD FORUMS LIST ################################################# 
Add this just above:

PHP Code:
// ### ALL LOGGED IN USERS #################################################
$activeusers1 '';
if (
$vboptions['displayloggedin'])
{
    
$datecut TIMENOW $vboptions['cookietimeout'];
    
$numbervisible 0;
    
$numberregistered1 0;
    
$numberguest1 0;

    
$forumusers $DB_site->query("
        SELECT
            user.username, (user.options & 
$_USEROPTIONS[invisible]) AS invisible, user.usergroupid,
            session.userid, session.inforum, session.lastactivity,
            IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
        FROM " 
TABLE_PREFIX "session AS session
        LEFT JOIN " 
TABLE_PREFIX "user AS user ON(user.userid = session.userid)
        WHERE session.lastactivity > 
$datecut
        " 
iif($vboptions['displayloggedin'] == 1"ORDER BY username ASC") . "
    "
);

    if (
$bbuserinfo['userid'])
    {
        
// fakes the user being online for an initial page view of index.php
        
$bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']);
        
$userinfos = array
        (
            
$bbuserinfo['userid'] => array
            (
                
'userid' => $bbuserinfo['userid'],
                
'username' => $bbuserinfo['username'],
                
'invisible' => $bbuserinfo['invisible'],
                
'inforum' => 0,
                
'lastactivity' => TIMENOW,
                
'usergroupid' => $bbuserinfo['usergroupid'],
                
'displaygroupid' => $bbuserinfo['displaygroupid'],
            )
        );
    }
    else
    {
        
$userinfos = array();
    }
    
$inforum = array();

    while (
$loggedin $DB_site->fetch_array($forumusers))
    {
        
$userid $loggedin['userid'];
        if (!
$userid)
        {    
// Guest
            
$numberguest1++;
            
$inforum["$loggedin[inforum]"]++;
        }
        else if (empty(
$userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity']))
        {
            
$userinfos["$userid"] = $loggedin;
        }
    }

    foreach(
$userinfos AS $userid => $loggedin)
    {
        
$numberregistered1++;
        if (
$userid != $bbuserinfo['userid'])
        {
            
$inforum["$loggedin[inforum]"]++;
        }
        
$loggedin['musername'] = fetch_musername($loggedin);

        if (
fetch_online_status($loggedin))
        {
            
$numbervisible++;
            eval(
'$activeusers1 .= ", ' fetch_template('forumhome_loggedinuser') . '";');
        }
    }

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

    
$activeusers1 substr($activeusers1 2); // get rid of initial comma

    
$DB_site->free_result($loggedins);

    
$totalonline1 $numberregistered1 $numberguest1;
    
$numberinvisible $numberregistered1 $numbervisible;

    
// ### MAX LOGGEDIN USERS ################################
    
$maxusers unserialize($datastore['maxloggedin']);
    if (
intval($maxusers['maxonline']) <= $totalonline1)
    {
        
$maxusers['maxonline'] = $totalonline1;
        
$maxusers['maxonlinedate'] = TIMENOW;
        
build_datastore('maxloggedin'serialize($maxusers));
    }

    
$recordusers $maxusers['maxonline'];
    
$recorddate vbdate($vboptions['dateformat'], $maxusers['maxonlinedate'], true);
    
$recordtime vbdate($vboptions['timeformat'], $maxusers['maxonlinedate']);

    
$show['loggedinusers'] = true;
}
else
{
    
$show['loggedinusers'] = false;
}
// ### ALL LOGGED IN USERS ################################################# 
That's it!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-07-2005, 05:30 PM
Tekton Tekton is offline
 
Join Date: Jun 2004
Location: Wisconsin
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Isn't this just sorta a template edit and not really anything to beta?
Reply With Quote
  #3  
Old 02-07-2005, 05:40 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is really already possible for forumdisplay by visting index.php?f=xx
Reply With Quote
  #4  
Old 02-07-2005, 06:32 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you guys have an easier way, please post it I am sure the person who requested it would appreciate it.

@Tekton, 2 templates and 1 file
Reply With Quote
  #5  
Old 02-07-2005, 08:10 PM
PamelaE PamelaE is offline
 
Join Date: Feb 2005
Posts: 158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That worked great. Thanks.
Reply With Quote
  #6  
Old 02-08-2005, 04:21 AM
dndog dndog is offline
 
Join Date: Apr 2004
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is just simple template work...hmm...
Reply With Quote
  #7  
Old 02-08-2005, 08:46 AM
Lt. Dan Lt. Dan is offline
 
Join Date: Feb 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did the first part - modifying the template - and it seemed to work fine.

What does editing the forumdisplay.php file do?
Reply With Quote
  #8  
Old 02-08-2005, 12:22 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It places who's online (for the entire site) at the top of the forumdisplay.
Reply With Quote
  #9  
Old 02-08-2005, 12:44 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dndog
This is just simple template work...hmm...
2 Templates
1 File


All I did with this (obviously) is moved the what's going on box in the forumhome template from the bottom to the top.

Then I directly copied the code from index.php, renamed a few variables with a '1' at the end and added it to the forumdisplay.php file, adding the same functionality. I thought it might be useful to others so I posted it up as a mod, I don't get why this is questioned? Am I cheating somewhere?
Reply With Quote
  #10  
Old 02-10-2005, 08:48 AM
Lt. Dan Lt. Dan is offline
 
Join Date: Feb 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I installed this and it works great BUT... Now the 'Most users ever online was...' no longer shows the single highest amount of users, but rather shows the current number of users and the current time.

How do I fix this?

For instance, I am currently the only person on my forum and this is what is displayed:

Most users ever online was 1, Today at 04:37 AM.

Before this hack it used to say 267 on (whatever the date was)

Any ideas?

Second problem...

The What's going on table only shows up on the Forum Home, not in the individual forums...

I'm using 3.0.6
Reply With Quote
Reply

Thread Tools

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 08:39 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.07530 seconds
  • Memory Usage 2,383KB
  • Queries Executed 23 (?)
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
  • (7)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete