Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: 1.00, by Mystics Mystics is offline
Developer Last Online: Jun 2015 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 01-10-2002 Last Update: Never Installs: 339
 
No support by the author.

Hack Name: Who was online today
Hack Version: 1.0.2
For vB Version:: 2.x
Originally Created by: genial @ Skats Board (Contact)
Documentation, Translation, a few changes and posted by: Mystics

Description:
This Hack adds something like the "Currently Active Users:"-Feature of vBulletin.
The difference is, instead of showing the users, who are currently online, it shows
all Users, who were online on a day and it also displays "Most users ever online on a day".

Summary of the Features:
  • Shows "Number of Active Users Today"
  • Shows "Most users ever online on a day"
  • Shows last online time for each User while pointing the Mouse Cursor on it's name (=mouseover) in the list
Important: The Hack only works 100% correct, when each member is in the same time zone as the Server!

Files to edit: index.php
Templates to edit: forumhome
New Templates: forumhome_todayloggedinusers, forumhome_todayloggedinuser

I have attached the Install Instructions in a Text File.
The Instruction is in English and in German.

I will attach a Screenshot in a Reply to this Thread!

Post any Questions into this Thread!

Updates in 1.0.1: Inserted the two new templates into the template precaching (first step)

Updates in 1.0.2: Fixed a little Bug with the "Most users ever online on a day"-Count
(Replace '$maxusers[2] = $todayonline;' with '$maxusers[2] = $numbertodayonline;' in index.php)

Info: You can find an other version of this Hack here. In this other version the usernames of the members, who were already online today, are not shown on the Forum-Mainpage; the names are shown in an extra File (like online.php), onlinetoday.php (Screenshot).

So, depending on which version of the Hack you prefer, you have to download this:
Version with usernames on the main Site of the Forum

or this:
Version with usernames on extra site (onlinetoday.php)

Regards,
Mystics

Show Your Support

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

Comments
  #437  
Old 01-28-2004, 08:42 PM
Bat21 Bat21 is offline
 
Join Date: Jan 2003
Location: UK
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have this hack installed on my Forum 2.2.9

I have recently moved to a dedicated server which is set to Mountain Time (US)
I have compensated for the 7 hour time difference by offsetting the Forum base time, so the default time for my site is GMT (UK)

The problem is the Who's online section doesn't start counting who has been on line untill 2 pm as opposed to starting at midnight.

Is there any way I can resolve this without altering the server time.

Thax
Reply With Quote
  #438  
Old 02-08-2004, 03:28 PM
scabs92c scabs92c is offline
 
Join Date: Feb 2004
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok guys forgive me here I am a newbe at this.
I am trying to get this hack to work. I have Vboard ver 2.
I have loaded all the hacks but I still get the original page????
I think it is still showing the default page?
Do I have to deleate the default template or something??
Anyhelp would be appreciated..
Scabs
Reply With Quote
  #439  
Old 02-13-2004, 02:11 PM
Emmy2 Emmy2 is offline
 
Join Date: Jan 2004
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm on vB2.3.4 and am having trouble with this hack. I can get it to show up, but the data is puzzling. For example, if I log out I get "0" members online today, even though there are people on the board right now! If I log in I get a number, but it seems that the tally resets at about 6am every day (I guess something to do with my server time) and all the names are cleared. However, what I would REALLY like is for it to give the names of visitors to the site in the past 24 hours, kind of a floating window of time, since I would like to see if anyone is visiting the site at, for example, 3 am in the morning. Unless I get up before 6 am and check the board their names will disappear by the time I get online. Make sense?

Long story short.....there is a feature in the Admn CP that lists visitors in the last 24 hours. It seems ideal. Is there a way to tap into that information, or duplicate it, and display it on my forum homepage?
Reply With Quote
  #440  
Old 02-24-2004, 08:14 AM
Rand M Rand M is offline
 
Join Date: Oct 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not using all of this hack, just the part that shows which members have "already visited the board today". So I dont know what affect it will have on "Number of Active Users Today:"

My forum (ver 2.2.8) is in the 'GMT' timezone but the server it is hosted on is US Eastern (-5) timezone.

After installing the hack everything worked as expected until 24hrs later when the "already visited the board today" showed 'nil' member 'names', even though members had been visiting my forum.

So I am experimenting with using 'gmmktime' instead of 'mktime' as used in the hack, which creates the Unix timestamp from the server.

I found this little snippet of information on a WWW search that provoked me to change the function.
"The timestamp returned is based upon the number of seconds from the epoch GMT, and then modified by the time zone settings on the server. Where you want time zone independence, you should use the function gmmktime"

So far so good, in that the member list now shows in "already visited the board today". This might be a solution for some others who run forums in a different timezone to the server that it is hosted on.

I've only been running with 'gmmktime' for a few hours so it is impossible to say if this will work permanently, if it still shows the 'members' 24 hours from now then it might be a solution.

The change is to the hack in index.php
Change
WHERE lastactivity > " . (mktime
To
WHERE lastactivity > " . (gmmktime

Like many others I am very new to coding in PHP so maybe an 'expert' or two might like to comment.
Reply With Quote
  #441  
Old 02-24-2004, 08:39 AM
Bat21 Bat21 is offline
 
Join Date: Jan 2003
Location: UK
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice one Rand M... you've just helped sort mine out, in index.php I found

(($bbuserinfo['timezoneoffset']+7)

and changed it to

(($bbuserinfo['timezoneoffset']-7)

cheers dude.... sorted now
Reply With Quote
  #442  
Old 02-24-2004, 10:31 AM
Rand M Rand M is offline
 
Join Date: Oct 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After changing the function from 'mktime' to 'gmmktime' I checked through results for different timezones , all showed correctly from -12 to +5.5 any timezone after +5.5 showed nil members .... which isn't correct. It was if the hack was compensating for the servers timezone offset.

I then had to change a little more from the hack to get it to display the correct number of members from -12 to +12 timezones.

I have no idea how correct these changes are to the hack but they do work on my forum (at the moment) when prior to these changes I wasn't seeing any members displayed.

The other part of the hack I changed was deleting the "$timeoffset" and replacing it with a "0" :

Changed:
WHERE lastactivity > " . (mktime(0,0,0,date("m"),date("d"),date("Y")) + (($bbuserinfo['timezoneoffset']-$timeoffset)*3600)) . "

To:
WHERE lastactivity > " . (gmmktime(0,0,0,date("m"),date("d"),date("Y")) + (($bbuserinfo['timezoneoffset']-0)*3600)) . "

I am still testing these changes, they may be a complete red herring but so far so good.
Reply With Quote
  #443  
Old 02-25-2004, 08:21 AM
Rand M Rand M is offline
 
Join Date: Oct 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

24 hours have gone by and the 'hack' is working without problems. I'm still seeing 'members names' who have already visited the board today and corrected if I log in from a different time zone

Its working so well that I've added back the "Number of Active Users Today"
Reply With Quote
  #444  
Old 02-27-2004, 03:25 PM
Emmy2 Emmy2 is offline
 
Join Date: Jan 2004
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Rand, I've been following your time adjustment system with interest, kinda hoping others would report in on how well it works before I try it myself. Is it still working well for you? Does it affect the timestamp on user's posts? For example, my webhost is on the west cost (-8 from GMT) so I have the time adjusted in my Admin CP to -8. Then, I'm on the east coast so I have to adjust my personal time zone in my Control Panel to -5 and somehow that all spits out the correct time on the board when I log in.

If I make the changes you've mentioned (to correct the Visited Today statistics) will it affect the time on the board itself? Will I have to change that -8 in the admin Control Panel, or the -5 in my user control panel? Will I have to ask my members to adjust their timezones?

It's so confusing! lol!
Reply With Quote
  #445  
Old 03-01-2004, 10:13 AM
Rand M Rand M is offline
 
Join Date: Oct 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Emmy,

No problems so far with the little changes to the hack.

We just moved our site from NY to Dallas and changed timezones in the process. I just changed the vB offset from -5 to -6 and everything still worked. Post times are still correct for GMT. No changes needed for 'user cp'.

I dont know how relevant the fact is that our site uses GMT as its timezone, all I can say is that the hack now works perfectly for our site
Reply With Quote
  #446  
Old 03-01-2004, 02:21 PM
Emmy2 Emmy2 is offline
 
Join Date: Jan 2004
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the reply Rand. I've made the changes and I'll let you know how it goes for my site. Right away my "visted today" jumped from 33 to 74 (which is I assume, the difference between members who visited since 6am this morning and members who visited in the last 24 hours). I need to let it run for a day or two to get a sense of what it's doing and how it's working.

Thanks for the help!
Reply With Quote
  #447  
Old 03-03-2004, 03:42 AM
blakkboy's Avatar
blakkboy blakkboy is offline
 
Join Date: Aug 2003
Location: Baltimore
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

aww i got a lil problem

there are people online but the users online is not listing them below
Reply With Quote
  #448  
Old 08-12-2005, 09:28 AM
Khashyar Khashyar is offline
 
Join Date: Jan 2003
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great Hack, Mystics... And great suggestions, Rand M...

The one thing that confuses me a bit is that when I am logged into my forum (and my user time is adjusted for Pacific S.T.,), then it shows 71 members at the moment.

However, when I log out, the time becomes GMT time on my board, and it shows 43 members... (but it shows 71 as the max users online in one day).

Should the users who have logged on in the past 24 hours be the same number, whether you are logged on or not?

I know that I am dragging an old thread out of the dark, but one of my VB boards still runs with 2.3.4, because I have many hacked and archive add-ons that I want to keep because they are serving me well.

I feel like the solution to the timezone consistency issue is in these lines of code:

Quote:
$todayloggedinusers = "";
$numbertodayonline = 0;
$numbertodayonlineinvisible = 0;

$todayusers=$DB_site->query("SELECT userid, username, usergroupid, lastactivity, invisible FROM user
WHERE lastactivity > " . (gmmktime(0,0,0,date("m"),date("d"),date("Y")) + (($bbuserinfo['timezoneoffset']-0)*3600)) . "
ORDER BY username");
Thanks for any ideas or thought as how I can keep the users who have been online in the past 24 hours the same whether a person is logged on or not.

Thanks,

Khashyar
Reply With Quote
  #449  
Old 08-12-2005, 09:53 AM
Khashyar Khashyar is offline
 
Join Date: Jan 2003
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think I figured it out...

To use GMT to decide who logged in the past day, wether you are logged in or logged out:

replace Rand M's code:

Quote:
WHERE lastactivity > " . (gmmktime(0,0,0,date("m"),date("d"),date("Y")) + (($bbuserinfo['timezoneoffset']-0)*3600)) . "
with this slightly altered code:
Quote:
WHERE lastactivity > " . (gmmktime(0,0,0,date("m"),date("d"),date("Y"))) . "
So far, at 3:53 in the morning, the figure for who has been online today is the same whether I am logged in or out......

I just wonder if it will set itself back to zero when it reaches midnight GMT or not?

I'll have to wait and see...

Khashyar
Reply With Quote
  #450  
Old 08-18-2005, 10:27 PM
MRGTB MRGTB is offline
 
Join Date: Dec 2004
Posts: 548
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really like this hack, it's one my very favourates. But I have a question that I need an answer to please. I installed this on vBulletin 2.3.7 and it is working fine.

But there is a section in the mod readme file which says search for this in you index.php file:

Code:
 if ((int)$maxusers[0] <= $totalonline) {
    $time = time();
    $maxloggedin = "$totalonline " . $time;
    $DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
    $maxusers[0] = $totalonline;
    $maxusers[1] = $time;
  }
and replace with this:

Code:
// today online hack begin
  if ((int)$maxusers[0] <= $totalonline) {
    $time = time();
    $maxloggedin = "$totalonline " . $time . " " . $maxusers[2] . " " . $maxusers[3];
    $DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
    $maxusers[0] = $totalonline;
    $maxusers[1] = $time;
  }

  $todayloggedinusers = "";
  $numbertodayonline = 0;
  $numbertodayonlineinvisible = 0;

  $todayusers=$DB_site->query("SELECT userid, username, usergroupid, lastactivity, invisible FROM user 
                WHERE lastactivity > " . (mktime(0,0,0,date("m"),date("d"),date("Y")) + (($bbuserinfo['timezoneoffset']-$timeoffset)*3600)) . " 
                ORDER BY username");
  while ($todayuser=$DB_site->fetch_array($todayusers)) {
    $numbertodayonline++;
    $invisibleuser = '';
    $userid = $todayuser['userid'];
    $lastactivetime = vbdate($timeformat, $todayuser[lastactivity]);
    if ($todayuser['invisible']==1 and $bbuserinfo['usergroupid']!=6) {
      $numbertodayonlineinvisible++;
      continue;
    }
    if ($todayuser['invisible'] == 1) { // Invisible User but show to Admin
      $invisibleuser = '*';
    }
    if ($todayuser['usergroupid'] == 6 and $highlightadmin) {
      $username = "<b><i>$todayuser[username]</i></b>";
    } else if (($mod["$userid"] or $todayuser['usergroupid'] == 5) and $highlightadmin) {
      $username = "<b>$todayuser[username]</b>";
    } else {
      $username = $todayuser['username'];
    }
    if (!$todayloggedinuser) {
      eval("\$todayloggedinuser = \"".gettemplate('forumhome_todayloggedinuser')."\";");
    } else {
      eval("\$todayloggedinuser .= \", ".gettemplate('forumhome_todayloggedinuser')."\";");
    }
  }

  $DB_site->free_result($todayusers);

  if ($bbuserinfo[usergroupid] == 6) {
    $todayonline = $numbertodayonline;
  } else {
    $todayonline = $numbertodayonline - $numbertodayonlineinvisible;
  }
  
  if ((int)$maxusers[2] <= $numbertodayonline) {
    $time = time();
    $maxloggedin = $maxusers[0] . " " . $maxusers[1] . " $numbertodayonline " . $time;
    $DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
    $maxusers[2] = $numbertodayonline;
    $maxusers[3] = $time;
  }
  
  $todayrecordusers = $maxusers[2];
  $todayrecorddate = vbdate($dateformat,$maxusers[3]);
  
  eval("\$todayloggedinusers = \"".gettemplate('forumhome_todayloggedinusers')."\";");
//today online hack end
------------------------------------------

But the code in my index.php file looks like this instead:

Code:
if (($maxusers[0] <= $totalonline AND $maxusers[0] > 0) OR sizeof($maxusers) == 1) {
    $time = time();
    $maxloggedin = intval($totalonline) . ' ' . $time;
    $DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
    $maxusers[0] = $totalonline;
    $maxusers[1] = $time;
  }
Which is different from the code your asked to search for and replace in the index.php. While I still replaced it anyway as a test and it works fine. I would like to know if I should have changed anything first in the code that replaced mine from the mod seeing as my code was different.

If I should have made some changes can you please post the whole code corrected that I need to use instead. Because I'm not a coder to do it myself.

thanks!
Reply With Quote
  #451  
Old 08-24-2005, 10:09 AM
kittykattjess kittykattjess is offline
 
Join Date: Aug 2005
Location: UK
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually I dont have forumhome_loggedinuser,forumhome_loggedinusers in my index.php, I cant find it either with "find" help.. so where do i pu/change it to the forumhome_todayloggedinuser,forumhome_todayloggedi nusers,forumhome_loggedinuser, forumhome_loggedinusers ?
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 07:52 AM.


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.05481 seconds
  • Memory Usage 2,378KB
  • Queries Executed 30 (?)
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
  • (3)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)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