Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard

Reply
 
Thread Tools
Members who have visited today (with last 24 hours option). Details »»
Members who have visited today (with last 24 hours option).
Version: 2.31, by Paul M Paul M is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.x Rating:
Released: 11-08-2004 Last Update: 07-23-2005 Installs: 627
 
No support by the author.

This modification is no longer available or supported.

A very simple display of all members who have visited the forum 'today' (i.e. since midnight). I looked at the existing hacks that apparently do this, and they either seemed over complicated or had a lot of problems, so I wrote my own simple version.


The main features of Version 2.xx are ;

1. It displays the list on Forum Home under the "Users online" display.

2. The list view is collapsable, so you just see the number.

3. Invisible users are only displayed to those allowed to see them (with a "*")

4. Users who should display as coloured or bold etc should be displayed correctly. (based on the display usergroup)

5. If you 'hover' over a username it will show the time they were last active.

6. The list is in member name order.


If you prefer, then there is an option to make this hack display a rolling 24 hours - un-comment the relevant line in the code.


Addons:
ericgtr has created a CMPS module for this hack, you will find the files here.
paul41598 has created a pop-up display instead of the collapsable display, you will find the files here.

Show Your Support

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

Comments
  #102  
Old 01-09-2005, 09:43 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Mosaicvb
Works like a charm for me. Thanks for your work. I hope I don't offend you by posting what I did.

I would like to know since I dont play in vB a lot whether anything I did would open a security hole.
Well it's a bit of a odd thing to do, but it won't open any security holes. However, you realise that by doing this, you will run the code on every vB page you ever view, not just the forumhome page ?
Reply With Quote
  #103  
Old 01-09-2005, 11:09 AM
samael samael is offline
 
Join Date: Jan 2005
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I got this error after editing the files.

Parse error: parse error, unexpected '\"', expecting ']' in /home/rpboards/public_html/forum/index.php(420) : eval()'d code on line 201
Reply With Quote
  #104  
Old 01-09-2005, 01:28 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That would suggest you made a mistake in the template update.
Reply With Quote
  #105  
Old 01-09-2005, 02:54 PM
good2laugh good2laugh is offline
 
Join Date: Jul 2002
Location: London
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and working perfectly - thanks, this was one of the easiest modifications/hacks I've used.
Reply With Quote
  #106  
Old 01-09-2005, 03:58 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see someone else has made a variation of this, I did also and I will share it here. Basically, I like the idea of it showing how many users are online today but not the names on my forumhome, I want that in a new page. The other modification for this does this but has never worked on my site, the numbers were different when you clicked on it. So I made it so this will work in a new page.

Create a new php page called online_today.php add all of the following code to it and save:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''online_today'); // change this depending on your filename 

// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array( 

); 

// get special data templates from the datastore 
$specialtemplates = array( 
     
); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
    
'online_today'
); 

// pre-cache templates used by specific actions 
$actiontemplates = array( 

); 

// ######################### REQUIRE BACK-END ############################ 
require_once('./global.php'); 

// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 

$navbits = array(); 
$navbits[$parent] = 'Online Today'
$now TIMENOW ;
require_once(
'./includes/functions_misc.php');
$cutoff vbmktime(000vbdate('m'$nowfalsefalse), vbdate('d'$nowfalsefalse), vbdate('Y'$nowfalsefalse));
//$cutoff = $now - 86400 ;  // Uncomment this line if you don't have vB 3.0.3 and all users are showing.
$todaysusers $DB_site->query("SELECT userid, lastactivity, options, username, opentag, closetag
FROM " 
TABLE_PREFIX "user as user
LEFT JOIN " 
TABLE_PREFIX "usergroup as usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastactivity > " 
.$cutoff" ORDER BY username" ); 

$totaltoday 0;
while (
$today $DB_site->fetch_array($todaysusers))
{
    
$today[visible] = ;
    
$totaltoday += 1;
    if (
$today[options] & $_USEROPTIONS[invisible]) 
    {
        
$today[visible] = ;
        if ((
$permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
        {
            
$today[visible] = ;
        }
    }
    if (
$today[visible]) 
    {
           
$wrdate vbdate($vboptions['timeformat'], $today['lastactivity']);
        
$whotoday .= "<a href='member.php?u=$today[userid]' title='$wrdate' >";
        if (
$today[visible] == 2
        {
            
$whotoday .= $today['opentag'].$today[username].$today['closetag']."</a>*, ";
        }
        else 
        {
            
$whotoday .= $today['opentag'].$today[username].$today['closetag']."</a>, ";
        }
    }
}
if (
$whotoday)
{
    
$whotoday substr($whotoday0strlen($whotoday)-2);
}

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 
eval(
'print_output("' fetch_template('online_today') . '");'); 

?>
Upload to your vb directory


Create a new template called online_today
PHP Code:
$stylevar[htmldoctype]
<
html dir="$stylevar[textdirection]lang="$stylevar[languagecode]">
<
head>
<
title>$vboptions[bbtitle]</title>
$headinclude
</head>
<
body>
$header
$navbar
<!-- Todays active users -->
<
tbody>
    <
tr>
        <
td class="thead" colspan="2">
            <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('forumhome_todayusers')"><img id="collapseimg_forumhome_todayusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_todayusers].gif" alt="" border="0" /></a>
            
Total users that have visited today$totaltoday
        
</td>
    </
tr>
</
tbody>
<
tbody id="collapseobj_forumhome_todayusers" style="$vbcollapse[collapseobj_forumhome_todayusers]">
    <
tr>
        <
td class="alt2"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="Users online today" border="0" /></td>
        <
td class="alt1" width="100%"><div class="smallfont">$whotoday</div></td>
    </
tr>
</
tbody>
<!-- 
Todays active users -->
</if>
$footer
</body>
</
html
NOTE: This is a change to the existing modification.

Now in your FORUMHOME template find:
PHP Code:
<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="$numberregistered2="$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="$recordusers2="$recorddate3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div>
                <
div>$activeusers</div>
            </
div>
        </
td>
    </
tr>
</
tbody>
<!-- 
end logged-in users -->

<!-- 
Todays active users -->
<
tbody>
    <
tr>
        <
td class="thead" colspan="2">
            <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('forumhome_todayusers')"><img id="collapseimg_forumhome_todayusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_todayusers].gif" alt="" border="0" /></a>
            
Total users that have visited today$totaltoday
        
</td>
    </
tr>
</
tbody>
<
tbody id="collapseobj_forumhome_todayusers" style="$vbcollapse[collapseobj_forumhome_todayusers]">
    <
tr>
        <
td class="alt2"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="Users online today" border="0" /></td>
        <
td class="alt1" width="100%"><div class="smallfont">$whotoday</div></td>
    </
tr>
</
tbody>
<!-- 
Todays active users -->
</if> 
Change to:
PHP Code:
<if condition="$show['loggedinusers']">

<!-- 
Todays active users -->
<
tbody>
    <
tr>
        <
td class="thead" colspan="2">
            <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('forumhome_todayusers')"><img id="collapseimg_forumhome_todayusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_todayusers].gif" alt="" border="0" /></a>
            <
a href="online_today.php?$session[sessionurl]">Total users that have visited today</a>: $totaltoday
        
</td>
    </
tr>
</
tbody>
<!-- 
Todays active users -->
</if> 
Reply With Quote
  #107  
Old 01-09-2005, 05:17 PM
Mosaicvb Mosaicvb is offline
 
Join Date: Sep 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
Well it's a bit of a odd thing to do, but it won't open any security holes. However, you realise that by doing this, you will run the code on every vB page you ever view, not just the forumhome page ?

Nope I didn't. Not good.. lol

thanks for the headsup
Reply With Quote
  #108  
Old 01-10-2005, 02:51 AM
shadiguy1 shadiguy1 is offline
 
Join Date: Jul 2004
Location: Delco,Pa
Posts: 146
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ERICGTR can u make this into a module for vbadvanced CMPS as i see you make alot of modules for CMPS
Reply With Quote
  #109  
Old 01-10-2005, 07:04 AM
Viks Viks is offline
 
Join Date: Sep 2004
Location: Toronto
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by shadiguy1
ERICGTR can u make this into a module for vbadvanced CMPS as i see you make alot of modules for CMPS
yes... do it.. do it
:nervous:
Reply With Quote
  #110  
Old 01-10-2005, 08:02 AM
BBoo BBoo is offline
 
Join Date: Feb 2004
Location: England
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Paul, just installed works perfect!
Reply With Quote
  #111  
Old 01-10-2005, 02:03 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Mosaicvb
I just installed this mod with vb 3.0.5 and it works great. I made some changes and I am posting what I did if you want to have an option that does not require altering the index.php.

1 : create a php file called whos.online.today.php with the following and upload to the root of the forum. :

PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

$now TIMENOW ;
require_once(
'./includes/functions_misc.php');
$cutoff vbmktime(000vbdate('m'$nowfalsefalse), vbdate('d'$nowfalsefalse), vbdate('Y'$nowfalsefalse));
//$cutoff = $now - 86400 ;  // Uncomment this line if you don't have vB 3.0.3 and all users are showing.
$todaysusers $DB_site->query("SELECT userid, lastactivity, options, username, opentag, closetag
FROM " 
TABLE_PREFIX "user as user
LEFT JOIN " 
TABLE_PREFIX "usergroup as usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastactivity > " 
.$cutoff" ORDER BY username" ); 

$totaltoday 0;
while (
$today $DB_site->fetch_array($todaysusers))
{
    
$today[visible] = ;
    
$totaltoday += 1;
    if (
$today[options] & $_USEROPTIONS[invisible]) 
    {
        
$today[visible] = ;
        if ((
$permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
        {
            
$today[visible] = ;
        }
    }
    if (
$today[visible]) 
    {
           
$wrdate vbdate($vboptions['timeformat'], $today['lastactivity']);
        
$whotoday .= "<a href='member.php?u=$today[userid]' title='$wrdate' >";
        if (
$today[visible] == 2
        {
            
$whotoday .= $today['opentag'].$today[username].$today['closetag']."</a>*, ";
        }
        else 
        {
            
$whotoday .= $today['opentag'].$today[username].$today['closetag']."</a>, ";
        }
    }
}
if (
$whotoday)
{
    
$whotoday substr($whotoday0strlen($whotoday)-2);
}

?>

2: Go to the style manager. Open the style you want to edit.
In the common template section goto the phpinclude_start box and enter :

Code:
ob_start(); 
include('whos.online.today.php');
ob_end_clean();

3: Follow your instructions for replacing the code in the Forumhome template.

Done.

Works like a charm for me. Thanks for your work. I hope I don't offend you by posting what I did.

I would like to know since I dont play in vB a lot whether anything I did would open a security hole.

You may want to consider adding a conditional to your phpinclude_start template to only run that query when the page selected is forum home or your new WWOL page. As it is that code runs on every page loaded whether it's used or not. Just a little optimization suggestion.
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 11:40 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.05906 seconds
  • Memory Usage 2,433KB
  • Queries Executed 25 (?)
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_code
  • (5)bbcode_php
  • (4)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
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete