PDA

View Full Version : Members who have visited today (with last 24 hours option).


Pages : [1] 2 3

Paul M
11-08-2004, 10:00 PM
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 (https://vborg.vbsupport.ru/showthread.php?p=652148).
paul41598 has created a pop-up display instead of the collapsable display, you will find the files here (https://vborg.vbsupport.ru/showthread.php?p=724321).

wrongful
11-09-2004, 11:57 PM
Works nice, thanks.

AN-net
11-10-2004, 02:57 AM
any screenshots?

Sweet Evil
11-10-2004, 07:38 AM
Nice and simple thanks.

Paul M
11-10-2004, 07:38 AM
any screenshots?added.

DutchyNL
11-10-2004, 10:37 AM
Nice one thanks for your greath share ;-)

Floris
11-10-2004, 01:24 PM
Database error in vBulletin 3.0.3:

Invalid SQL: SELECT userid, lastactivity, options, username,opentag,closetag
FROM vb3_user
LEFT JOIN vb3_usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastactivity > 1100037600
mysql error: Unknown table 'user' in on clause

mysql error number: 1109Oopsy?

sabret00the
11-10-2004, 01:34 PM
is this available for the WOL instead of the forumhome?

RaZor Edge
11-10-2004, 01:40 PM
I've just install this hack...

I have run the SQL query...

But on my forum home... it show that all my members have come online today (1898 on 1898)

What's wrong???

Paul M
11-10-2004, 02:17 PM
Oopsy?Indeedy. :disappointed:

Almost certainly a table prefix problem as we don't use them, I'll confirm this for you tonight, when I have access to my dev system, and update the query.

Paul M
11-10-2004, 02:23 PM
But on my forum home... it show that all my members have come online today (1898 on 1898)

What's wrong???I have no idea, what times does it show for each member when you hover over them ?

RaZor Edge
11-10-2004, 02:25 PM
I have no idea, what times does it show for each member when you hover over them ?It show only the time

Ex: 11h31 (a different time for everyone)

Paul M
11-10-2004, 02:26 PM
is this available for the WOL instead of the forumhome?Not from me. You could do it, but it would mean moving the code to a different place, and then copying the relevant part of the template change - virtually a whole new version really.

Paul M
11-10-2004, 02:29 PM
It show only the time

Ex: 11h31 (a different time for everyone)I take it you are sure they haven't all visited ?

If so, pick a few you are sure haven't, then look at the time when you hover over them, and then check their profiles to see what the Last Active date & time is.

I'll check back later.

RaZor Edge
11-10-2004, 02:32 PM
I take it you are sure they haven't all visited ?

If so, pick a few you are sure haven't, then look at the time when you hover over them, and then check their profiles to see what the Last Active date & time is.

I'll check back later.
yes... it's impossible that all my members (100% of 1899) have come today at 11:31!! :nervous:

I will look at this.

RaZor Edge
11-10-2004, 02:37 PM
Ok, the time is right... but not the date!!!

Ex:

user 1: 16:32 (Home index time)
Last activity: 11/06/2003 16h32 (in profil)

user 2: 22:00 (Home index time)
Last activity: 26/03/2003 22h00 (in profil)

I've try to re-install a clean version of functions_misc.php but the problem is still there.

I've try to change the date format to the american style, don't work neither...

(I use the latest version of vbulletin)

BarHopper
11-10-2004, 04:20 PM
Isnt this, like exactly the same to Garys?

taffy056
11-10-2004, 07:08 PM
Nice hack installed with no problems at all

Paul M
11-10-2004, 07:34 PM
Database error in vBulletin 3.0.3:

Invalid SQL: SELECT userid, lastactivity, options, username,opentag,closetag
FROM vb3_user
LEFT JOIN vb3_usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastactivity > 1100037600
mysql error: Unknown table 'user' in on clause

mysql error number: 1109Oopsy?
Floris,

I believe that replacing the four lines of the SQL query with this should work.


$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. " ");


Please let me know and I will update the instructions.

Paul M
11-10-2004, 07:58 PM
Ok, the time is right... but not the date!!!

Can you try replacing the day/month/year lines of the code with these;


$nowday = vbdate('d', $now. false, false);
$nowmonth = vbdate('m', $now. false, false);
$nowyear = vbdate('Y', $now. false, false);


If that fails then temporarily add the following line above the SQL query ;

echo "Cutoff = ".$cutoff;

this will cause the forumhome to display a line at the top saying something like

Cutoff = 1100044800

post the result back here we can see what cutoff date it has calculated.

RaZor Edge
11-11-2004, 05:36 AM
Can you try replacing the day/month/year lines of the code with these;


$nowday = vbdate('d', $now. false, false);
$nowmonth = vbdate('m', $now. false, false);
$nowyear = vbdate('Y', $now. false, false);


If that fails then temporarily add the following line above the SQL query ;

echo "Cutoff = ".$cutoff;

this will cause the forumhome to display a line at the top saying something like

Cutoff = 1100044800

post the result back here we can see what cutoff date it has calculated.
I've made the change you ask, here,s the results:

Cutoff = -3601

I've got the same result if i don't apply the change

:(

Tradjick
11-11-2004, 05:45 AM
Is it possible to show todays visits only to admin?

Paul M
11-11-2004, 06:37 AM
I've made the change you ask, here,s the results:

Cutoff = -3601

I've got the same result if i don't apply the change

:(Well that makes no sense at all, clearly the wrong value, but it's calculated using standard vB functions.

Remove the ECHO line and replace it with this ;

echo "Today = ".$nowday."/".$nowmonth."/".$nowyear." : Now = ".$now;

and post the result back.

also, what OS are you running your forum on ?


Is it possible to show todays visits only to admin?Yes, just enclose the relevant template section with an "if" conditional.

Lethal
11-11-2004, 04:49 PM
isn't this the same as who was online today?

https://vborg.vbsupport.ru/showthread.php?threadid=59579

Paul M
11-11-2004, 07:08 PM
isn't this the same as who was online today?

https://vborg.vbsupport.ru/showthread.php?threadid=59579No.

It is similar but simpler, read the first post.

shadiguy1
11-11-2004, 08:36 PM
here is my forumhome template im not sure wher ei should put the new info because i do have other hacks installed A whos in chat stuff is in there iw ill post if someone can take a look and let me know thanks it will be unmder the lines.
--------------------------------------------------------------------------------

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">

<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<!-- end no cache headers -->
<title><phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title>
$headinclude

<body>
$header
$navbar

<!-- top statistics box -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="xtreem/category/left.gif" width="97" height="45"> </td>
<td width="100%" valign="middle" background="xtreem/category/background.gif" class="alt5" ><a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
<center><a><b>Statistics - Top 5</b></a>
</center>
<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
</td>
<td><img src="xtreem/category/right.gif" width="85" height="45"></td>
</tr></table>

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

<tbody id="collapseobj_forumhome_statistics" style="$vbcollapse[collapseobj_forumhome_statistics]">
<tr>
<td class="thead" width="23%" align="$stylevar[left]" nowrap>Top Posters</td>
<td class="thead" width="22%" align="$stylevar[left]" nowrap>Newest Members</td>
<td class="thead" width="55%" nowrap>Newest Replies
</td>
</tr>
<tr>
<td class="alt2" width="23%" valign="top">
<table>
<tr>
<td class="smallfont" width="100%">Member:</td>
<td class="smallfont" align="right" nowrap>Posts:</td>
</tr>
$stats_posters
</table>
</td>
<td class="alt1" width="22%" valign="top">
<table>
<tr>
<td class="smallfont" width="100%" nowrap>Member:</td>
<td class="smallfont" align="right" nowrap>Posts:</td>
</tr>
$stats_members
</table>
</td>
<td class="alt2" width="55%" valign="top">
<table>
<tr>
<td class="smallfont" width="70%" nowrap>Thread:</td>
<td class="smallfont" width="30%" nowrap>Last Poster:</td>
<td class="smallfont" align="right" nowrap>Views:</td>
<td class="smallfont" align="right" nowrap>Replies:</td>

</tr>

$stats_threads
</table>
</td>
</tr>
</tbody>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="xtreem/catbottom/left.gif" width="30" height="27"></td>
<td background="xtreem/catbottom/background.gif" width="100%"></td>
<td><img src="xtreem/catbottom/right.gif" width="33" height="27"></td>
</tr>
<!-- end top statistics box -->

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="row">
<!-- Marquee Banner By VINNYCUZ -->
<center>
<font size=+1 color=white>
<marquee width=100% bgcolor=#424E62 behavior=left scrollamount="6"> NEXTEL ELITE LATEST NEWS: <a href=http://www.nextelelite.com/forums/flashchat/flashchat.php>Check out the new Chat Room</a> <font color=yellow>*****</font> <font color=White>Please Subscribe to Nextel Elite if you like the site this will enable us to add more features for you.</marquee>
</font>
</center>
<!-- Marquee Banner By VINNYCUZ -->
<!-- main -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

<if condition="$show['guest']">
<!-- guest welcome message -->
<tr>
<td class="tcat" colspan="6"><phrase 1="$vboptions[bbtitle]">$vbphrase[welcome_to_the_x]</phrase></td>
</tr>
<tr>
<td class="alt1" colspan="6">
<phrase 1="faq.php?$session[sessionurl]" 2="register.php?$session[sessionurl]">$vbphrase[first_visit_message]</phrase>
</td>
</tr>
<!-- / guest welcome message -->
</if>
</table>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
$forumbits
</table>
<!-- /main -->
<br><br>
<!-- 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')"$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_statusicon]/forum_link.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>
<tr>
<td class="thead" colspan="2">
<a href="http://www.nextelelite.com/forums/FlashChat/flashchat.php">Who's in Chat?</a>
</td>
</tr>
<tr>
<td class="alt2"><a href="online.php?$session[sessionurl]"><img src="$stylevar[imgdir_misc]/icon_chat.gif" alt="Who's in chat?" border="0" /></a></td>
<td class="alt1" width="100%">
<div class="smallfont">

$chatwho
</div>
</td>
</tr>
</tbody>

<!-- end logged-in users -->
$todayloggedinusers
</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">&nbsp;</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_statusicon]/birthday.gif" alt="$vbphrase[view_birthdays]" border="0" /></a></td>
<td class="alt1"><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_icon.gif" alt="$vbphrase[calendar]" border="0" /></a></td>
<td class="alt1"><div class="smallfont">$upcomingevents</div></td>
</tr>
</tbody>
</if>
<tbody>
<tr>
<td class="tfoot" align="center" colspan="6"><div class="smallfont"><strong>
<a href="forumdisplay.php?$session[sessionurl]do=markread">$vbphrase[mark_forums_read]</a>
&nbsp; &nbsp;
<a href="showgroups.php?$session[sessionurl]">$vbphrase[view_forum_leaders]</a>
</strong></div></td>
</tr>
</tbody>
</table>
<br />

<!-- end what's going on box -->

<!-- icons and login code -->
<table cellpadding="0" cellspacing="2" border="0" width="100%">
<tr valign="bottom">
<td>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td><img src="$stylevar[imgdir_statusicon]/forum_new.gif" alt="$vbphrase[contains_new_posts]" border="0" /></td>
<td class="smallfont">&nbsp; $vbphrase[forum_contains_new_posts]</td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_statusicon]/forum_old.gif" alt="$vbphrase[contains_no_new_posts]" border="0" /></td>
<td class="smallfont">&nbsp; $vbphrase[forum_contains_no_new_posts]</td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_statusicon]/forum_old_lock.gif" alt="$vbphrase[a_closed_forum]" border="0" /></td>
<td class="smallfont">&nbsp; $vbphrase[forum_is_closed_for_posting]</td>
</tr>
</table>
</td>
<if condition="!$show['guest']">
<!-- member logout -->
<td align="$stylevar[right]"><a href="login.php?$session[sessionurl]do=logout" onclick="return log_out()"><phrase 1="$bbuserinfo[username]">$vbphrase[log_out_x]</phrase></a></td>
<!-- end member logout -->
</if>
</tr>
</table>
<!-- / icons and login code --></th>
</tr>
</table>
$footer
</body>
</html>

Paul M
11-11-2004, 10:02 PM
here is my forumhome template im not sure wher ei should put the new info because i do have other hacks installed A whos in chat stuff is in there iw ill post if someone can take a look and let me know thanks it will be unmder the lines.Yes, you have hacked it about a bit.

Try modyfing it as follows ;

After ;

<!-- end logged-in users -->
$todayloggedinusers

Add below;


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

shadiguy1
11-11-2004, 11:09 PM
Yes, you have hacked it about a bit.

Try modyfing it as follows ;

After ;

<!-- end logged-in users -->
$todayloggedinusers

Add below;


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

thankls that worked out for me much appreciated bro. anyway to get it alphabetised.?

Paul M
11-12-2004, 10:36 AM
thankls that worked out for me much appreciated bro. anyway to get it alphabetised.?Yes, if you replace the WHERE line of the SQL with this ;

WHERE lastactivity > " .$cutoff. " ORDER BY username" );

It will now show them alphabetically. I have made this the default in v1.03

RWDF1
11-12-2004, 11:19 AM
Nice, installed, now I can monitor who has been on, and who hasnt posted etc, I have found people are logging in to use the arcade and not post anything.

RaZor Edge
11-12-2004, 06:17 PM
Well that makes no sense at all, clearly the wrong value, but it's calculated using standard vB functions.

Remove the ECHO line and replace it with this ;

echo "Today = ".$nowday."/".$nowmonth."/".$nowyear." : Now = ".$now;

and post the result back.

also, what OS are you running your forum on ?

here's the result:

Today = d/m/Y : Now = 1100290578

My host is on UNIX... I think....

Thank you for taking time to help me with this... :nervous:

Paul M
11-12-2004, 08:24 PM
here's the result:

Today = d/m/Y : Now = 1100290578
Then the calls to vbdate are failing.

I have no idea why - but I notice you are using vB 3.0.1 - so maybe it's something to do with that.


There are two choices ;

1. Try and find out why the vbdate calls are failing.

or

2. Do this quick hack ;

Replace the $cutoff line with this;


$cutoff = $now - 86400;


This will show the visitors in the last 24 hours rather than since midnight.

FleaBag
11-13-2004, 12:46 AM
Simplicity in it's greatest form! Just what I was looking for... Thanks. :)

jos
11-13-2004, 03:45 PM
Hi,

Is there anyway to see a record of nr of visitors (non registered) who visited a community... i get everyday lots of registered and non registered visitors... i can see now with 3.0.3 a snapshot of one day, the day i am viewing, but i have no idea how many came yesterday, or the day before or a week before.

is there anyway to hack this, to get something like this on the forums index page?

thanks
jos

Paul M
11-13-2004, 06:52 PM
Hi,

Is there anyway to see a record of nr of visitors (non registered) who visited a community... i get everyday lots of registered and non registered visitors... i can see now with 3.0.3 a snapshot of one day, the day i am viewing, but i have no idea how many came yesterday, or the day before or a week before.

is there anyway to hack this, to get something like this on the forums index page?

thanks
josSorry, I have not seen such a hack anywhere.

dieselpowered
11-15-2004, 05:51 AM
Thanks, works like a champ!

etaslim
11-16-2004, 09:54 AM
installed! works great with no problem at all

internetjunkie
11-16-2004, 11:25 PM
thank you kindly

cdoyle
11-17-2004, 12:22 AM
Worked great!!
Thanks

Carnage Media
11-17-2004, 04:44 AM
is there a way that this can be made to open in a new window? it would have the totals for the day and keep a history but you would click on it to show all the names?

Paul M
11-17-2004, 07:56 AM
is there a way that this can be made to open in a new window? it would have the totals for the day and keep a history but you would click on it to show all the names?I'm sure it could, but not by me I'm afraid, Sorry.

Viks
11-17-2004, 11:22 PM
Action: Installed (thalforum.com)

Comments: Easy installation, easy to follow instructions, works as said.

Issues:
I'm running vB3.0.3 but i cud not get it to run using the following:-
$cutoff = vbmktime(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));

INSTEAD i had to use the following:
$cutoff = $now - 86400 ; which shows users during last 24 hrs.

Suggestions:
1. If you can further modify this almost perfect mod to
- function with CMPS
- Admin's can modify to show "who was online in last XX hours"
- Instead of showing phrase "Total users that have visited today:" - it wud show who was online in last XX hrs (depending on the hack).

... specially - function with CMPS

Thanks paul.

Vik

Paul M
11-18-2004, 03:28 PM
Sorry, I have no idea what CMPS is .....

Viks
11-18-2004, 03:40 PM
Sorry, I have no idea what CMPS is .....

sorry about that.

vBadvanced CMPS (Content Management & Portal System)
http://www.vbadvanced.com/products.php?

Its a very popular portal system for vB and many boards use it. If only u cud assist me getting this hack working on the homepage .. or the CMPS (INDEX) page... it will be GREAT!!!
..only if...

Paul M
11-18-2004, 06:05 PM
vBadvanced CMPS (Content Management & Portal System)
http://www.vbadvanced.com/products.php?

Its a very popular portal system for vB and many boards use it. If only u cud assist me getting this hack working on the homepage .. or the CMPS (INDEX) page... it will be GREAT!!!
I can't see how I would do that without installing CMPS and testing it etc, which I'm not prepared to do, sorry.

I'm curious to know why the vbdate function fails on some installations.

Pepelux71
11-23-2004, 01:55 AM
install

Pepelux71
11-23-2004, 08:27 AM
When no one is in the chat room it appears like this:
"Currently -1 user(s) chatting.

How can i fix it?

Paul M
11-23-2004, 10:07 AM
When no one is in the chat room it appears like this:
"Currently -1 user(s) chatting.

How can i fix it?Chat Room ? Sorry but I see no connection between this and a chat room - vB has no chat built into it.

JohnBee
11-24-2004, 03:48 PM
Nie hack,thank you!

One request "if at all possible" could you make it so the hidden users
are hidden in the online pane as well?

reason is, I use a custom user account for my vB news intergration hack
and I would like to hide that user name from the listing.

ex: *site news

Any help would be greatly appreciated

Paul M
11-24-2004, 08:02 PM
Nie hack,thank you!

One request "if at all possible" could you make it so the hidden users
are hidden in the online pane as well?

reason is, I use a custom user account for my vB news intergration hack
and I would like to hide that user name from the listing.

ex: *site news

Any help would be greatly appreciated

Sorry - but I'm not sure I follow - are you referring to the "Currently Active Users" display ? If so, this is a native part of vB and not related to this hack.

Viks
11-28-2004, 12:43 AM
I can't see how I would do that without installing CMPS and testing it etc, which I'm not prepared to do, sorry.

I'm curious to know why the vbdate function fails on some installations.

Can someone here assist me in getting this hack further moded to work in CMPS!!
come'on guys help a brother out...will appreciate it

Vik

misuse
11-28-2004, 02:18 AM
Worked great for me so far. Thanks! Installed.

folkish
12-02-2004, 04:45 PM
Great mod. Simple, easy to follow instructions. Installed mere minutes ago.
Thanks.

deb0
12-04-2004, 03:42 PM
nice job. Installed

MotoUp
12-07-2004, 06:50 PM
Excellent! Much Much easier than the other mods. Only took about 30 seconds to install. Thanks.

MovieMaster
12-15-2004, 07:03 PM
Works like a champ on this v3.0.3!

H2k
12-16-2004, 02:07 AM
I can't see how I would do that without installing CMPS and testing it etc, which I'm not prepared to do, sorry.

I'm curious to know why the vbdate function fails on some installations.
i have install this hack .. but there is nathing dont show me any Online list any idea about this .. it's blank.

thankyou

Roxie
12-16-2004, 02:48 AM
Hi. I installed it nicely; however, when different usergroups have different color names. It shows up on who's online, but only some of the colors show up on Who was online today. Any ideas?

Roxie
12-16-2004, 03:14 AM
I have figured out that it goes by the primary usergroup and not the display group. Can this be edited some kind of way?

Paul M
12-16-2004, 10:35 AM
i have install this hack .. but there is nathing dont show me any Online list any idea about this .. it's blank.

thankyouMake sure you have installed it correctly, there isn't really that much in it to go wrong.

Tipi
12-16-2004, 05:00 PM
Nice one! :D

pingme
12-16-2004, 05:52 PM
Coooooool :D

Boots
12-17-2004, 03:51 PM
excellent mod! love it!

Paul M
12-17-2004, 08:43 PM
I have figured out that it goes by the primary usergroup and not the display group. Can this be edited some kind of way?I had a look at this for you and it doesn't look like it's a quick and easy change, so I'm afraid you will have to take it as is, Sorry.

TwinsX2Dad
12-18-2004, 01:08 AM
This is simplicity perfected. Thank you for a nice addition.

Install clicked!

Paul M
12-18-2004, 10:32 AM
My what's going on box is located underneath the navbar. I would like to put this hack on the bottom where the what's going on box used to be orginally. Where in the forumhome template would I place the code?
In your template find ;


<br />
<br />
(just under the "<!-- /main -->" line)

replace those two line breaks with ;

<br />
<!-- Todays active users -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<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>
</table>
<!-- Todays active users -->
<br />


:)

biggkay
12-18-2004, 06:33 PM
Thanks...Works nicely.
/me click install.

tormodg
12-19-2004, 08:33 AM
Thanks...Works nicely.
* biggkay click install.
This is a cool hack. *installs*

noppid
12-22-2004, 10:46 PM
Great Job! Thanks.

ForumRelated
12-23-2004, 01:16 PM
great mod. simple and easy. just how mods should be. Good job Paul.

Sia Bani
12-24-2004, 06:37 AM
Where's the one that updated all the time in that it didn't reset at 12:00 AM? So it was continuous?

I've installed this, but I thought there was a slight mod so you don't see it reset and blank out at 12:00AM.

Thanks.

Paul M
12-24-2004, 09:30 AM
Where's the one that updated all the time in that it didn't reset at 12:00 AM? So it was continuous?

I've installed this, but I thought there was a slight mod so you don't see it reset and blank out at 12:00AM.

Thanks.Uncomment the second $cutoff line (that refers to not having vB 3.0.3).

Sia Bani
12-24-2004, 09:45 AM
Uncomment the second $cutoff line (that refers to not having vB 3.0.3).
Thanks for the reply. Anyway you could explain that a little more? I have no idea what you're talking about. I have 3.0.3 as well.

Paul M
12-24-2004, 11:15 AM
Okay, there is a line in the 1.03 version that you can just uncomment, but if you installed a while ago that line won't be there;

Find the line that starts "$cutoff = " in the hack - and replace it with ;

$cutoff = $now - 86400 ;

This will make it always display visitors from the last 24 hours. :)

LCPGUY
12-25-2004, 09:31 PM
Wow! This works just great and so easy to install. I thank you Paul.

I have a question though, When I run the SQL ‘ALTER TABLE user ADD INDEX (lastactivity)”

I get the following error:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'john_mainDB.user' doesn't exist

Any suggestions would be appreciated.

Again, thanx for a terrific hack!!!

John

Paul M
12-25-2004, 09:47 PM
LCPGUY, Where are you running the query ?

Sia Bani
12-25-2004, 09:48 PM
Okay, there is a line in the 1.03 version that you can just uncomment, but if you installed a while ago that line won't be there;

Find the line that starts "$cutoff = " in the hack - and replace it with ;

$cutoff = $now - 86400 ;



This will make it always display visitors from the last 24 hours. :)


I just installed this a couple days ago and I have the $now-86400 in the hack already. I hadn't changed anything, and it's already there. However, at midnight, it still resets. Do you want me to change that to just $cutoff?

Paul M
12-25-2004, 09:55 PM
I just installed this a couple days ago and I have the $now-86400 in the hack already. I hadn't changed anything, and it's already there. However, at midnight, it still resets. Do you want me to change that to just $cutoff?Um.... Can you PM me the first few lines of this hack that you actually have installed please.

LCPGUY
12-26-2004, 05:58 PM
LCPGUY, Where are you running the query ?

From the Admin CP, Import and Maintenance, Execute SQL Query

Paul M
12-26-2004, 06:26 PM
I suggest you do it directly on the database via myphpadmin.

TMAC
12-31-2004, 08:58 PM
Thank you for this hack. :)

Up the thread a way it was asked Is it possible to show todays visits only to admin?

I did not see any answer and just wanted to make sure I did not miss out on how to do this.

Thank You!

Paul M
12-31-2004, 11:54 PM
Thank you for this hack. :)

Up the thread a way it was asked

I did not see any answer and just wanted to make sure I did not miss out on how to do this.

Thank You!I replied in post 23. Just enclose the template display code in an IF conditional for usergroup 6.

TNAImpact
01-01-2005, 09:02 PM
Brilliant Hack.

Would it be possible to move the feature in which when you hover over the username the last time they were online comes up? Could I move that somehow?

Thanks for your time.

Paul M
01-01-2005, 09:11 PM
Brilliant Hack.

Would it be possible to move the feature in which when you hover over the username the last time they were online comes up? Could I move that somehow?

Thanks for your time.Sorry, I don't understand. What do you mean by move it - move it to where ?

TNAImpact
01-01-2005, 09:13 PM
Sorry, I don't understand. What do you mean by move it - move it to where ?

Move it, finito, nothing, none, basically get rid of the hover feature that shows their last visit, keeping everything else.

Paul M
01-01-2005, 09:19 PM
Move it, finito, nothing, none, basically get rid of the hover feature that shows their last visit, keeping everything else.Oh right, you mean remove it completely. :)

Change ;

$whotoday .= "<a href='member.php?u=$today[userid]' title='$wrdate' >";
to ;

$whotoday .= "<a href='member.php?u=$today[userid]' >";
and don't forget to click install :)

TNAImpact
01-01-2005, 09:20 PM
Thankyou for the very quick reply. :) Keep up the great work. I shall click install now. :D

Thanks again.

funkmeister
01-02-2005, 01:46 AM
I have a bit of an oddity occuring!

When I have for example, 50 users who have visited so far today, certain members are only seeing 20 (example) as having visited. Guests and most other members (as far as I'm aware) are seeing the correct number of 50.

Any ideas why certain members would see different numbers than everyone else? There are no 'invisible' (*) members or special usergroups involved.

Thanks.

Paul M
01-02-2005, 10:51 AM
Maybe they have different timezone settings in their profiles ?

funkmeister
01-03-2005, 05:01 AM
Maybe they have different timezone settings in their profiles ?
Doh, yes indeed - that was it :)

Thanks.

cclaerhout
01-03-2005, 11:38 PM
Doh, yes indeed - that was it :)

Thanks.
Do i have to change the value "$cutoff = $now - 86400 " if my forum's default time is GMT+1 ? Because at midnight, the number of users who have visited the forum doesn't init.

Great hacks anyway thanks :-)

Paul M
01-03-2005, 11:47 PM
Do i have to change the value "$cutoff = $now - 86400 " if my forum's default time is GMT+1 ? Because at midnight, the number of users who have visited the forum doesn't init.

Great hacks anyway thanks :-)That piece of code will give a rolling count for the previous 24 hours and is commented out (unless you have removed the "//"). It is only there as a backup because the vbdate function was not working on some systems - allthough some people are using it by default because this is what they want to do.

cclaerhout
01-04-2005, 06:57 AM
That piece of code will give a rolling count for the previous 24 hours and is commented out (unless you have removed the "//"). It is only there as a backup because the vbdate function was not working on some systems - allthough some people are using it by default because this is what they want to do.

Thanks for this explanation. I'm using Vb 3.04 and i was forced to remove the // before the code ; Otherwise all users were listed. So, if i well understand, now this hacks is "Who connected last 24 hours" :)

Paul M
01-04-2005, 09:42 AM
So, if i well understand, now this hacks is "Who connected last 24 hours" :)Yep, that is how yours will be working.

Kylie
01-04-2005, 10:45 AM
Thanks Paul works well, I've used some other versions but this is the easiest to see. I like the time "alt"

colcas
01-08-2005, 02:37 AM
hi Paul great mod,

I have had it running perfect up to last night - I did the 3.0.5 upgrade and it doesn't show who's been on line today, just a blank box no entries

I'm new to v-bulletin - do you have any ideas what might need to be changed to get it working again

thanks in advance

Paul M
01-08-2005, 10:23 AM
hi Paul great mod,

I have had it running perfect up to last night - I did the 3.0.5 upgrade and it doesn't show who's been on line today, just a blank box no entries

I'm new to v-bulletin - do you have any ideas what might need to be changed to get it working again

thanks in advanceHave you re-done the files changes after you upgraded ?

btw - you are not showing as having installed this - please click install.

colcas
01-08-2005, 10:14 PM
Sorry Paul - I must have forgot to click 'Install'

I checked the new 'index.php' file and it didn't seem to have the

line
// ### LOGGED IN USERS #########################################

This is where I got stuck - it had that line in my 3.0.3 version index.php but doesn't seem to have it in the new 3.0.5 version

the code for the forum home template is in and shows the box for the users who visited today

but as I don't know where to mod the index.php file as it doesn't have the 'LOGGED IN USERS line

hope this clarifies it a bit

Cheers

Paul M
01-09-2005, 12:00 AM
Sorry Paul - I must have forgot to click 'Install'

I checked the new 'index.php' file and it didn't seem to have the

line
// ### LOGGED IN USERS #########################################

This is where I got stuck - it had that line in my 3.0.3 version index.php but doesn't seem to have it in the new 3.0.5 version

Well my index.php (3.0.5) has it, at line 274. :) - Just do a text search for "LOGGED IN".

Mosaicvb
01-09-2005, 05:49 AM
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
// ####################### 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(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));
//$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] = 1 ;
$totaltoday += 1;
if ($today[options] & $_USEROPTIONS[invisible])
{
$today[visible] = 0 ;
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
{
$today[visible] = 2 ;
}
}
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($whotoday, 0, strlen($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 :

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.

Paul M
01-09-2005, 09:43 AM
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 ?

samael
01-09-2005, 11:09 AM
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

Paul M
01-09-2005, 01:28 PM
That would suggest you made a mistake in the template update.

good2laugh
01-09-2005, 02:54 PM
Installed and working perfectly - thanks, this was one of the easiest modifications/hacks I've used. :D

ericgtr
01-09-2005, 03:58 PM
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
// ####################### 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(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));
//$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] = 1 ;
$totaltoday += 1;
if ($today[options] & $_USEROPTIONS[invisible])
{
$today[visible] = 0 ;
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
{
$today[visible] = 2 ;
}
}
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($whotoday, 0, strlen($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

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions</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>


[B]NOTE: This is a change to the existing modification.

Now in your FORUMHOME template find:

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

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

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

Mosaicvb
01-09-2005, 05:17 PM
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

shadiguy1
01-10-2005, 02:51 AM
ERICGTR can u make this into a module for vbadvanced CMPS as i see you make alot of modules for CMPS

Viks
01-10-2005, 07:04 AM
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:

BBoo
01-10-2005, 08:02 AM
Thanks Paul, just installed works perfect! :)

noppid
01-10-2005, 02:03 PM
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
// ####################### 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(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));
//$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] = 1 ;
$totaltoday += 1;
if ($today[options] & $_USEROPTIONS[invisible])
{
$today[visible] = 0 ;
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
{
$today[visible] = 2 ;
}
}
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($whotoday, 0, strlen($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 :

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

ericgtr
01-10-2005, 02:16 PM
ERICGTR can u make this into a module for vbadvanced CMPS as i see you make alot of modules for CMPS
I can probably work this out although it would make for a pretty huge box on the side.. maybe a center module of some sort. If Paul M gives his okay I will look into it for you.

shadiguy1
01-10-2005, 02:31 PM
yah a nice botom ceneter block would be sweet i hope paul will give u the go ahead cause a few people were asking in the thread his hack is awsome and it woukd be sweet to have it work on the CMPS.

Paul M
01-10-2005, 02:54 PM
I can probably work this out although it would make for a pretty huge box on the side.. maybe a center module of some sort. If Paul M gives his okay I will look into it for you.Sure, if you do a CMPS version I will attach it to the hack as an option (with suitable credit of course :))

ericgtr
01-10-2005, 08:41 PM
Okay, here it is in a collapsable module. Upload onlinetoday.php file to your modules directory and create a new template called adv_portal_onlinetoday and copy the context of adv_portal_onlinetoday.txt into it.

Create a new module

Module Title: Total Online Today

Module Identifier: (leave blank)

File to Include: onlinetoday.php

OR Template to Include: (leave blank)

Templates Used: adv_portal_onlinetoday

Test this out, it works okay for me but for some reason whenever I create a new module it shows up on my forumhome at the bottom in a center block no matter where I tell it do display, that may just be me though.

Paul M
01-10-2005, 08:53 PM
Thanks, I have updated the main post with a note pointing to your module. :)

ericgtr
01-10-2005, 08:56 PM
Thanks.. I just now noticed that someone else posted a module for the other hack for this lol. Oh well, hope I didn't reinvent the wheel with this, besides your mod works on my site :)

colcas
01-10-2005, 10:31 PM
Well my index.php (3.0.5) has it, at line 274. :) - Just do a text search for "LOGGED IN".


Paul - sorry m8 for not getting back to you earlier - yes it is there - and it works a treat again

it must have been me - or something to do with my set up - picking up something from a cache - or just simply 'user interface problems' :rolleyes:

Anyway - cheers for a great and easy to use hack

Hellspire
01-11-2005, 04:09 AM
Good job, installed/

shadiguy1
01-11-2005, 02:13 PM
eric for some reason its not showing up for me.

ericgtr
01-11-2005, 02:19 PM
eric for some reason its not showing up for me.
Can you be more specific?

shadiguy1
01-11-2005, 03:23 PM
i did all the stuff made the template and added the module and put the php file in the modules directory ande nothing is coming up at all on my CMPS and i did make sure that it is active.

shadiguy1
01-11-2005, 03:48 PM
eric if u have aim hit me up i can let u look into my forums ADMINCP and see that i did everything hit me up on aim shadiguy1.

ericgtr
01-11-2005, 03:59 PM
Okay, to be sure this is what your module setup should like like.. see screenshot.

ericgtr
01-11-2005, 04:11 PM
eric if u have aim hit me up i can let u look into my forums ADMINCP and see that i did everything hit me up on aim shadiguy1.
I can't use it at work, I won't be home until about 4:30 (PST)

shadiguy1
01-11-2005, 04:15 PM
here are my screen shots.

ericgtr
01-11-2005, 04:23 PM
here are my screen shots.
If you want to PM me with admin access to your server I will take a look.

shadiguy1
01-11-2005, 04:39 PM
pm sent with info

ericgtr
01-11-2005, 05:59 PM
pm sent with info
I think I found it, I updated the onlinetoday.php re-upload it and see if it works now.

shadiguy1
01-11-2005, 06:48 PM
its displaying but i think ther eis something wrong with the template part now. Please take a look.. here are screen shots.

ericgtr
01-11-2005, 06:54 PM
Okay, how does it work if you try it on a side?

Here is the template again, in case I missed something in the inital post.


<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat smallfont" style="font-weight: bold;"><a style="float: $stylevar[right]" href="#" onclick="return toggle_collapse('forumhome_$mods[filename]')"><img id="collapseimg_forumhome_$mods[filename]" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_randomtopic].gif" width="15" height="15" border="0" alt="Collapse/Expand" /></a>$vba_options[portal_blockbullet] $mods[title]</td>
</tr>
</thead>
<tfoot style="display: none;"><tr><td></td></tr></tfoot>
<tbody id="collapseobj_forumhome_$mods[filename]">
<tr style="$vbcollapse[collapseobj_forumhome_randomtopic]">
<td class="$getbgrow">
<!-- Todays active users -->
$whotoday
<!-- Todays active users -->
</td>
</tr>
</tbody>
</table>
<br />

shadiguy1
01-11-2005, 06:59 PM
only thing not showing up is actually how many have visited it showed them correctly just need to put the number on it .. Of how many actuall have visited ill show yah what it looks like as of now.

ericgtr
01-11-2005, 07:14 PM
only thing not showing up is actually how many have visited it showed them correctly just need to put the number on it .. Of how many actuall have visited ill show yah what it looks like as of now.
Okay, I added that. I replaced the adv_portal_onlinetoday.txt re-upload it and you should be good.

shadiguy1
01-11-2005, 07:15 PM
worked thanks for all the trouble heheh much appreciated bro,

ericgtr
01-11-2005, 07:19 PM
worked thanks for all the trouble heheh much appreciated bro,
That's okay, we want it to be right if it's going to be posted :) I have so many little tweaks in my templates that sometimes it's hard to keep track of what's what which is where things got confused lol.

Twigz
01-11-2005, 07:32 PM
Great work. Worked like a Charm. *InStalled*

stumparoooo
01-16-2005, 05:21 AM
I'm still pretty new to vBulletin and this is my first time trying a hack, so forgive me if this is a stupid question.

I'm running version 3.05 and just tried to install it. On my forum's home page, the box shows "Total users that have visited today", but no users are showing up. It's completely blank.

I followed the directions and modified the index.php code in SmartFTP and the FORUMHOME template in the AdminCP. Do you have any idea why the box shows, but no usernames? What can I do to make it work??

Thank you in advance for your time.

Paul M
01-16-2005, 11:10 AM
Are you sure you saved the modified index.php file ?

stumparoooo
01-16-2005, 03:36 PM
Are you sure you saved the modified index.php file ?
Yes, the modified index.php file is saved.


The whole code was copy and pasted in the index right above "Logged In Users".


edit: My mistake--I forgot to upload it after saving it in FTP. :speechless:

Thank you for your time, though!!

It works now and I love it! :):)

sportsoutlaw
01-16-2005, 06:10 PM
great addition to my forum, thanks.

Hexemer
01-17-2005, 09:05 PM
Thanks, works nice! :)

MickDoneDee
01-20-2005, 12:40 PM
Thanks again for the hack, Paul. Just wondering whether you could also do a companion hack to appear under this hack to show "Total users that have posted today"?

Paul M
01-20-2005, 06:32 PM
Thanks again for the hack, Paul. Just wondering whether you could also do a companion hack to appear under this hack to show "Total users that have posted today"?Hmm, not something I would use, but I'll look into it for you. :)

MickDoneDee
01-20-2005, 06:41 PM
Thanks, Paul. I think it would be useful to see how many people actually post when logging in. It would be extra nice if when a name is clicked a page opens containing the posts that they made "today". So that the posts for that individual are displayed like a thread. This would be more convenient than the advanced search function.

Treasure Quest
01-21-2005, 02:34 PM
Hello,
I had this mod installed on my Vb 3.0.6 yesterday and its not showing any users as visiting the forum. Any suggestions as to what might be the problem?

http://www.treasurequestxlt.com/community/


Thank you,

Greg

Vevina
01-21-2005, 03:08 PM
Thanks Paul, me likes :)

But when i "hover" over user names the time is not showing, it's showin as Registered User, Moderator etc :(

Can you tell me what ive done wrong or need to do to correct it please !!

Paul M
01-21-2005, 03:43 PM
Hello,
I had this mod installed on my Vb 3.0.6 yesterday and its not showing any users as visiting the forum. Any suggestions as to what might be the problem?
At a guess you either haven't done the file edit to index.php, or you haven't uploaded the edited file.

BTW, you aren't showing as having it installed it. :)

Paul M
01-21-2005, 03:47 PM
Thanks Paul, me likes :)

But when i "hover" over user names the time is not showing, it's showin as Registered User, Moderator etc :(

Can you tell me what ive done wrong or need to do to correct it please !!There is no way I can think of for this to happen, hell, it would need a bit of extra code if you wanted to do this.

what is your site address ?

Vevina
01-21-2005, 03:51 PM
address in pm :)

Treasure Quest
01-21-2005, 04:28 PM
At a guess you either haven't done the file edit to index.php, or you haven't uploaded the edited file.

BTW, you aren't showing as having it installed it. :)
Hi Paul and thanks, the code would have been uploaded because I have the box for the "Last users visited" right,
http://www.treasurequestxlt.com/community/

I'll check it again,

Greg

Paul M
01-21-2005, 06:33 PM
Hi Paul and thanks, the code would have been uploaded because I have the box for the "Last users visited" right,
http://www.treasurequestxlt.com/community/No, the box display is from the template change, which you have obviously done. The code that creates the list (in index.php) is missing.

Vevina
01-21-2005, 07:34 PM
ok ive just tried it again and now i'm gettin this:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/fhlinux199/r/research-complete.co.uk/user/htdocs/forums/includes/adminfunctions_template.php(3054) : eval()'d code on line 194

line 194 $styles = $DB_site->query("SELECT styleid, title, parentlist, parentid, userselect FROM " . TABLE_PREFIX . "style ORDER BY parentid");

line3054 eval('$devnull = "' . $template . '";');

Please Help !! :ermm:

Paul M
01-21-2005, 07:57 PM
You appear to have broken a template - the only template used by this hack is FORUMHOME so I suggest you revert it and start again.

Paul M
01-22-2005, 11:53 AM
Thanks, Paul. I think it would be useful to see how many people actually post when logging in. It would be extra nice if when a name is clicked a page opens containing the posts that they made "today". So that the posts for that individual are displayed like a thread. This would be more convenient than the advanced search function.See Members who have posted today (https://vborg.vbsupport.ru/showthread.php?t=74869) :)

kodeking
01-23-2005, 06:38 PM
I love it. Simple and works

Bluetiereign
01-23-2005, 08:17 PM
Got the identical error..fixed with a revert to original.


ok ive just tried it again and now i'm gettin this:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/fhlinux199/r/research-complete.co.uk/user/htdocs/forums/includes/adminfunctions_template.php(3054) : eval()'d code on line 194

line 194 $styles = $DB_site->query("SELECT styleid, title, parentlist, parentid, userselect FROM " . TABLE_PREFIX . "style ORDER BY parentid");

line3054 eval('$devnull = "' . $template . '";');

Please Help !! :ermm:

Bluetiereign
01-23-2005, 08:38 PM
BTR <*installs*> :classic:

Paul M
01-23-2005, 10:04 PM
Got the identical error..fixed with a revert to original.I guess you made an error somewhere. :)

chinch
01-27-2005, 03:06 AM
nice job with this mod!

is there any way to have it show visitors from the last "24 hours" instead of "today".

for example my list just went from 341 members down to 5 after midnight :)

detalhe
01-27-2005, 01:37 PM
I've instaled it, works great, but I'd like to know where can I modify the 'Total Users.....' phrase to another language than English ;)

Paul M
01-27-2005, 04:06 PM
nice job with this mod!

is there any way to have it show visitors from the last "24 hours" instead of "today".

for example my list just went from 341 members down to 5 after midnight :)Uncomment this line ;

//$cutoff = $now - 86400 ; // Uncomment this line if you don't have vB 3.0.3 and all users are showing.

Paul M
01-27-2005, 04:15 PM
I've instaled it, works great, but I'd like to know where can I modify the 'Total Users.....' phrase to another language than English ;)It's embedded in the template code, see this extract ;

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

detalhe
01-27-2005, 05:20 PM
It's embedded in the template code, see this extract ;

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

Great!! Thanks ;)

chinch
01-27-2005, 09:51 PM
Uncomment this line ;

//$cutoff = $now - 86400 ; // Uncomment this line if you don't have vB 3.0.3 and all users are showing.

thanks... will try that now :)

MajorFm.com
01-29-2005, 08:03 PM
What about...

Where it says:
Members That Have Visited Today - Total: 75

I want:
Total That Have Visited Today - Members: 75 Guests: ??

I want to display the total guests aswell

Paul M
01-29-2005, 08:37 PM
That would be very difficult to do.

Lyricsmama
02-01-2005, 08:00 PM
Added and simple thx!

KanyeWest
02-02-2005, 01:54 AM
thanks man :nervous:

pingme
02-02-2005, 05:38 AM
Uncomment this line ;

//$cutoff = $now - 86400 ; // Uncomment this line if you don't have vB 3.0.3 and all users are showing.


Paul, I did this, but still it cuts off the users at midnight :( Can you please help in making it rolling 24hrs

Paul M
02-02-2005, 07:33 AM
Paul, I did this, but still it cuts off the users at midnight :( Can you please help in making it rolling 24hrsSorry, but if you have correctly uncommented it (removed the first two slashes, not the second set) and saved it - then it is impossible for it not to work. I suggest you check your edit. :)

bigmonay2k
02-02-2005, 12:49 PM
see attachment :disappointed: thank you

pingme
02-02-2005, 01:33 PM
Sorry, but if you have correctly uncommented it (removed the first two slashes, not the second set) and saved it - then it is impossible for it not to work. I suggest you check your edit. :)


hehehe :D Silly me, I added two more lines as I read it "comment this line"

I will check it tonight

Thanks for quick reply Paul

Paul M
02-02-2005, 11:58 PM
see attachment :disappointed: thank youA template error - check that you modified it correctly.

mystery250
02-03-2005, 05:22 PM
Hmm. The who's online today, when I install this, is blank.

I am sure I installed it right, as I have used the previous versions, and they have worked glitch free....

Paul M
02-03-2005, 09:29 PM
Hmm. The who's online today, when I install this, is blank.

I am sure I installed it right, as I have used the previous versions, and they have worked glitch free....Not really sure what you mean - a link may help.

Check your edits again. :)

zaon
02-05-2005, 05:21 AM
Thanks, Paul!!

Works great :-)

And yes, SIMPLE is indeed way better than the other hacks I've seen that involve tampering with the database itself or requiring so many other modifications/changes. Your hack also makes for better compatibility with regular vbulletin 3.x.x releases.

So thanks again! :-)

bigmonay2k
02-07-2005, 03:17 AM
A template error - check that you modified it correctly.
it only happen when members in my board have b-day(Today's Birthdays) :ermm: if there's no b-day it's fine dude..I really does not know what to do.

Paul M
02-07-2005, 12:03 PM
it only happen when members in my board have b-day(Today's Birthdays) :ermm: if there's no b-day it's fine dude..I really does not know what to do.PM me a copy of your template.

ALcorn
02-07-2005, 01:15 PM
Very nice hack, Paul M. Just one thing is missing for me - number of guests who have visited. Is it possible to add this info into the hack ? Thank you again.

Paul M
02-07-2005, 02:48 PM
Very nice hack, Paul M. Just one thing is missing for me - number of guests who have visited. Is it possible to add this info into the hack ? Thank you again.Sorry, it's not possible.

BocaDev
02-08-2005, 06:15 PM
Works great, thanks! :)

Viks
02-08-2005, 08:48 PM
Oh GREAT!! this is cool, I've been looking for this.
thanks Ericgtr.
I've installed it.. however i have some minor issue. I've attached a pic...whats happenning is that
1. the FONT size of members is bigger compared to other locations..

2. On click on "membername" the url takes me to root/members instead of root/forums/member.

any suggestions how i can fix this!?

thanks

Viks
02-09-2005, 04:17 AM
any suggestions how i can fix this!?

thanks

ok I fixed the problem. It was just a temeplate edit to match my font.

But Eric i got another issue! The Module shows online visitors "today" starting at midnight but Paul's original mod shows users in last 24 hours on my fourmshome.

:ermm:

I thought, it wud show the number of users on cmps page as forumshomepage which is users visited in last 24 hrs.??!?!

isnt that right??

Paul M
02-09-2005, 07:31 AM
But Eric i got another issue! The Module shows online visitors "today" starting at midnight but Paul's original mod shows users in last 24 hours on my fourmshome.
Uncomment this line to switch to the rolling 24 hr's ;

//$cutoff = $now - 86400 ; // Uncomment this line if you don't have vB 3.0.3 and all users are showing.

:)

Viks
02-09-2005, 08:37 AM
thanks Paul.

Pamela
02-10-2005, 05:03 AM
Easy installation and great instructions. Thanks! :)

havefun
02-10-2005, 10:46 AM
works fine, thx paul :)

Paul M
02-15-2005, 03:47 PM
I have uploaded v1.35 today which has a very minor bugfix - this will not affect anyone who already has this working - but I think it may cure the odd case (in vb versions prior to 3.0.3) where the vbdate function would not work (and hence people switched to the rolling 24 hours display).

Trekkie
02-15-2005, 03:48 PM
nice

hankster
02-22-2005, 02:21 PM
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. :)

Does anyone know how this conditional could be added?

MickDoneDee
02-23-2005, 12:07 AM
Try:

<if condition="THIS_SCRIPT=='index'>
ob_start();
include('whos.online.today.php');
ob_end_clean();
</if>

In case people are wondering where your quote came from it was:
https://vborg.vbsupport.ru/showpost.php?p=593061&postcount=110

zaon
02-23-2005, 04:28 PM
You're saying that the code we inserted into index.php gets launched and processed all the time because a template called "phpinclude_start" (present in most templates on the board) points to code in index.php and so is referenced in showthread and other various templates on the board? So the proposed conditional tells phpinclude_start to only call the todays active users code from index.php when and if the template calling is the forum home but otherwise to ignore that code in index.php? (sorry, newbie, so a bit lost here).

MickDoneDee
02-23-2005, 05:31 PM
To learn a bit more about phpinclude_start have a look at these links:

https://vborg.vbsupport.ru/showthread.php?t=71313

http://www.vbulletin.com/docs/html/main/templates_phpinclude_start

http://www.vbulletin.com/forum/showthread.php?t=128925&highlight=phpinclude_start

The reason Mosaicvb is using phpinclude_start is because he doesn't want to edit/hack his index.php file which voids the Jelsoft User Support eligability. So he created a PHP script (whos.online.today.php) that will do the same job using the phpinclude_start template to create the HTML and insert the data on the forum home page. However, since the phpinclude_start template loads with every page a conditional is used to run the whos.online.today.php file only when the index.php page is loaded.

Paul M
02-23-2005, 09:47 PM
You're saying that the code we inserted into index.php gets launched and processed all the time because a template called "phpinclude_start" (present in most templates on the board) points to code in index.php ........... No.

Just to be clear and repeat what MickDoneDee is saying - this hack edits index.php, and the code only runs when you are on the forum homepage.

However, Mosaicvb decided that they didn't want to run it this way and built themselves a seperate php file with the hack code in it, and then added code to the phpinclude_start template to run his file (see here (https://vborg.vbsupport.ru/showpost.php?p=592309)). The problem being that this means it gets run on every vb Page that you view, not just the forumhome page. I do not support this method of running it.

zaon
02-24-2005, 06:57 AM
oh ok, thanks Paul!!

Yeah, I run it in the default method except for uncommenting for rolling 24 hours because of international clientele ;-)

lazytown
02-25-2005, 12:07 AM
Great mod. What kind of performance hit does this cause?

-V

Paul M
02-25-2005, 07:49 AM
Great mod. What kind of performance hit does this cause?

-V
It adds about 0.01 seconds to the homepage.

Mosh
02-25-2005, 09:29 PM
Paul,

This is nice and simple and works great, it is by far the easiest 'Last Visited' hack to install (1 php file alteration, 1 template alteration and an optional SQL query) have available atm by far, I know I have tried them all at one stage or another.

Also works without a hitch with v 3.0.7 and the optional query does speed up page load time.

Thanks for the painless install.

jd :)

smokering
02-27-2005, 03:42 PM
excellent and simple to use thank you

Paul M
02-27-2005, 04:41 PM
excellent and simple to use thank youThanks.

jozo1
02-28-2005, 04:11 AM
great work, very simple! just take one minute to hacks this mod, thank again !

Paul M
02-28-2005, 09:31 AM
Hi jozo1 - I notice that you (and smokering, and a few odd others) have not clicked the "Install this Modification" link (just above the download link).

Being new to the site I expect you are not really aware of this - but clicking on this adds you to a list of people who have the hack installed - which helps the writer see how many people have the code, and also allows you to receive any notes sent out about updates. Please could you spare 30 seconds to do this - thanks.

KanyeWest
03-01-2005, 06:14 PM
paul please help im stupid i dontn o how to read it to make 24 hours help help

Paul M
03-01-2005, 06:27 PM
Sorry but I don't see what else I can tell you - the hack clearly tells you to uncomment a line to switch to the rolling 24 hours - I don't see how I could make it any plainer than it already is.

eva01_
03-01-2005, 06:37 PM
i think the instructions are pretty simple don't see what your problem is o_O

KanyeWest
03-01-2005, 07:43 PM
Sorry but I don't see what else I can tell you - the hackclearly tells you to uncomment a line to switch to the rolling 24 hours- I don't see how I could make it any plainer than it alreadyis.
see i haev add i dont understand like most people i dont no if i shoulduncomment the line before and after and which line im sorry

do i take out this line .? please highlite in quote in ur post what line i shold take out im sorry im stupid llol

$now = TIMENOW ;
require_once('./includes/functions_misc.php');
$cutoff = vbmktime(0, 0, 0, vbdate('m', $now, false, false), vbdate('d', $now, false, false), vbdate('Y', $now, false, false));
//$cutoff = $now - 86400 ; // Uncomment this line if you want a rolling 24 hours display.
$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" );

Paul M
03-01-2005, 07:54 PM
I'm really not sure if this is a wind up ....

Which bit of " uncomment this line " are you finding hard to understand ?

(apart from which, only one line is commented out anyway).

and you should not be quoting the hack for all to see either.


If you really don't understand it then I suggest you either find someone to install it for you, or don't bother. I cannot help you any further.

eva01_
03-01-2005, 07:56 PM
just take out the "//" in //$cutoff = $now - 86400 ;

since // means comment after

KanyeWest
03-01-2005, 08:10 PM
i dont wanna piss off paul eva can u please help me out of desperasion i no im very stupid but i cant help it my aim is idenonfire or pm me pelase thanks
my site is idenonfire.com

KanyeWest
03-01-2005, 08:22 PM
wow thank you eva helped me out and thanks paul for helpin me im just stupid

well thanks again works like a charm

Vampyre
03-02-2005, 03:30 AM
Work like a charm!!
Thanks for the nice work, Paul M. :)

Mechanical Mind
03-02-2005, 04:28 PM
* clicks install *

Worked flawlessly. I love this hack because it shows that the forums are busy, without having to up your "cookie timeout" time and lie about how many people are actually online. Like some people do, no names of course.

Great job Paul! :classic:

JAYEMULE
03-03-2005, 02:50 PM
I uninstalled this mod because I could not fix it. It showed all my members been on line that day when it was not so. I liked the idea and was sure easy enough to add but I just couldn't get to work showing ONLY the actual members that visited, not the entire member list.
I will watch for new working versions.

Jaye

Paul M
03-03-2005, 03:20 PM
I uninstalled this mod because I could not fix it. It showed all my members been on line that day when it was not so. I liked the idea and was sure easy enough to add but I just couldn't get to work showing ONLY the actual members that visited, not the entire member list.
I will watch for new working versions.

JayeWell 300 odd other people seem to think it works perfectly. :)

Which version number did you install (or what date did you download it). There was a small error that seemed to cause this problem on mainly pre 3.0.3 versions of vB - it was fixed on Feb 15th.

JAYEMULE
03-03-2005, 03:48 PM
Well 300 odd other people seem to think it works perfectly. :)

Which version number did you install (or what date did you download it). There was a small error that seemed to cause this problem on mainly pre 3.0.3 versions of vB - it was fixed on Feb 15th.

I did not mean be speaking poorly of the mod. Not what I meant at all. I just installed it 2 days ago and got the file at same time. I read the posts here but did not see that there had been a fix so I just uninstalled it. If this is fixed that would be great. I do like this mod for sure. Should I try to do it again and see if it works out better ? You say this is all starightend out now ? I am have vb 3.7 working at this time.

Jaye

Paul M
03-03-2005, 04:33 PM
So you have 3.0.7 and you downloaded it two days ago - this doesn't sound promising TBH - can you just make sure that the code you have is version 1.35 - if it is then you already have the code with what I hoped was the potential fix.

My problem is I cannot make it fail - it is the vbdate() function that fails on some servers, and I don't know why. Can you confirm what your server OS and PHP versions are ?

The rolling 24 hour version still works on these servers - just uncomment the relevant line.

JAYEMULE
03-03-2005, 06:32 PM
Yes, I had version 1.35 of wh was online today. I would sure love to use this mod. I will keep watching for the fix.
Sorry forgot the rest.
I use win XP pro and the latest version of php and my sql

Paul M
03-03-2005, 08:32 PM
The fix is to use the rolling 24 hours option - there will be no other fix as I have no way to reproduce the problem.

Mike54
03-03-2005, 09:28 PM
I just added ericgtr's module for the CMPS and it works great. Many thanks!

Mike

AmpSul
03-04-2005, 01:06 AM
worked like a charm!
(i've been running vb for less than a week and this is my first installed hack!)

keep up the good work!!!

Agent Jones
03-05-2005, 04:06 PM
I have doubles of everyone, how to fix it?

Paul M
03-05-2005, 04:55 PM
I have doubles of everyone, how to fix it?Link ?

sportsoutlaw
03-07-2005, 02:03 AM
just upgraded from 3.0.5 to 3.0.7 and modifed the index.php.

Still works great, thanks Paul for your efforts in this little hack.

zaon
03-07-2005, 08:14 PM
Love the hack.. but think I discovered one minor bug...

It DOES display special formatting/colors as assigned by usergroup so that names appear same in the 24 hr list as they do for currently active users.. BUT.. only if that formatting is from the primary user group. I have a couple members with a secondary usergroup which has the option set to override formatting, and it does override (causing name to appear in bold) in the currently active list but appears without formatting in the 24 hr list.

Is this fixable?

The one active member i have now is 'dejong' if you happen to catch him online at www.zaon.org then you can see how his formatting is special in currently active but unmodified in 24 hr list. His name should be bolded in both lists like our Moderators are (whose formatting is specified in our primary usergroup).

Took me a while to figure that one out, but seems to be what's going on here.

MickDoneDee
03-07-2005, 08:46 PM
This question was also raised here: https://vborg.vbsupport.ru/showthread.php?p=582864&highlight=color#post582864

I think Paul said somewhere that it was too complicated to make colors work for Secondary usergroup. So that feature is not available for this hack.

zaon
03-07-2005, 08:55 PM
Awww... gotcha.. Ok.

Paul M
03-07-2005, 10:24 PM
Awww... gotcha.. Ok.
Yep, sorry, as MickDoneDee says - it would add a load of extra code - and I want this hack to be as simple as possible. :)

See https://vborg.vbsupport.ru/showpost.php?p=583390&postcount=64

wildondallas
03-09-2005, 08:24 AM
Installed and works great.

wildondallas, clicked install:up:

Moncal
03-11-2005, 01:10 AM
Great Hack!

Perfect in every way.

scottm
03-12-2005, 12:05 AM
great and easy, thanks. :)

Jeremy_Dallas
03-12-2005, 03:37 AM
I'm getting the following when I try to save my changes to the FORUMHOME template:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/a/l/t/altirisadmin/html/vbulletin/includes/adminfunctions_template.php(3096) : eval()'d code on line 195

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

Any Ideas?

Paul M
03-12-2005, 12:22 PM
Yes, you have made an error editing the template - revert it and try again.

Antivirus
03-12-2005, 08:17 PM
Great hack, and my first one I have ever installed, great instructions, went off without a hitch!

(clicked install)

hendri
03-13-2005, 07:47 AM
yes... it's impossible that all my members (100% of 1899) have come today at 11:31!! :nervous:

I will look at this.
cool !!!!!!!!

Paul M
03-17-2005, 07:25 AM
cool !!!!!!!!That's a very old quote in your post, I'm not quite sure why you have posted it - but there have been a few updates since then, and I believe that problem should no longer exist. :)

lefthome
03-17-2005, 03:56 PM
I installed this hack and it is very nice, but I have a question. Is it possible to add a code to show, not the name or as in other hacks, guest, guest, guest, but just the total number of visitors who visited the board today?

Dalvosaber
03-17-2005, 04:46 PM
How do I restrict to a certain usergroup please detail it carefully for me cos im not sure

Paul M
03-17-2005, 05:37 PM
I installed this hack and it is very nice, but I have a question. Is it possible to add a code to show, not the name or as in other hacks, guest, guest, guest, but just the total number of visitors who visited the board today? It already shows the number of members who have visited. It is not possible to add the number of guests.

How do I restrict to a certain usergroup please detail it carefully for me cos im not sureI don't understand what you mean - restrict what exactly ?

eva01_
03-17-2005, 05:43 PM
i believe Paul M that he wants the members online today to only show a single usergroup a the online today...maybe

lefthome
03-17-2005, 08:47 PM
On my board I have installed hacks showing the total number of members that have posted today. The board also shows the total number of members who visited today, but what I want is to show the total number of visitors who visited today. I understand that current visitors are shown in the ?currently active users? (members, guests and spiders) but when they leave the numbers are gone and I want to keep those without using the scripts that I?ve located here that list each visitor as; guest1, guest2, guest3, and so on. I just want to retain the total number of visitors.

Paul M
03-18-2005, 06:50 AM
I understand that current visitors are shown in the ?currently active users? (members, guests and spiders) but when they leave the numbers are gone and I want to keep those without using the scripts that I?ve located here that list each visitor as; guest1, guest2, guest3, and so on. I just want to retain the total number of visitors. Yes, I understood what you want, but this hack cannot do that (nor will it be changed).

lefthome
03-18-2005, 11:59 AM
Yes, I understood what you want, but this hack cannot do that (nor will it be changed).Thanks anyway. Like I said the hack is very nice.

sim tech
03-19-2005, 05:51 AM
Installed nicely on 3.0.7... took about 3 minutes.

I noticed in my index.php I had also installed the:
"Members who have posted today" hack... you must be the same "Paul" that created that impressive one as well? My users loved that one, so I'm sure they'll be just as impressed with this latest one.

One question though (and I apologize for this) but I am a php noob and I've tried several things & all failed:

On both mods, The string:
WHERE lastactivity > " .$cutoff. " ORDER BY username" );

What the heck is the correct word to use (in place of username) if I want the names to be sorted by what time they logged in, instead of alphabetically?

Thanks-

sim tech
03-20-2005, 03:42 AM
I think I may have a clue as to what the one poster was talking about as far as it not working.

Maybe he has both of your mods just like me. I found that if the
Total members that have posted today
and the
Total users that have visited today

had both of their time set to reset at midnight (not rolling 24 hours) then one of them would not work, typically the Total users that have visited today one. ( Is this because of where it's placed in reference to the other?

So I changed one to show the rolling 24 hours, and the other was just on regular time, and they both started working.

At least that's how it appeared on this end.
:alien:



// ############### Paul M - Who has visited today v1.40 #################

require_once('./includes/functions_misc.php');
$now = TIMENOW - intval($vboptions['hourdif']);
//$cutoff = vbmktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now));
$cutoff = $now - 86400 ; // ## Uncomment this line if you want a rolling 24 hours display ## //
$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] = 1 ;
$totaltoday += 1;
if ($today[options] & $_USEROPTIONS[invisible])
{
$today[visible] = 0 ;
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
{
$today[visible] = 2 ;
}
}
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($whotoday, 0, strlen($whotoday)-2);
}

// ############# End of Who has visited today ###############



// ############# Paul Marsden - Who has posted today v1.40 ###############
$now = TIMENOW ;
require_once('./includes/functions_misc.php');
$cutoff = vbmktime(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));
//$cutoff = $now - 86400 ; // Uncomment this line if you want a rolling last 24 hours.
$todaysposters = $DB_site->query("SELECT userid, lastpost, options, username, opentag, closetag
FROM " . TABLE_PREFIX . "user as user
LEFT JOIN " . TABLE_PREFIX . "usergroup as usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastpost > " .$cutoff. " ORDER BY username" );

unset ($posttoday);
$posterstoday = 0;
while ($today = $DB_site->fetch_array($todaysposters))
{
$today[visible] = 1 ;
$posterstoday += 1;
if ($today[options] & $_USEROPTIONS[invisible])
{
$today[visible] = 0 ;
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
{
$today[visible] = 2 ;
}
}
if ($today[visible])
{
$wrdate = vbdate($vboptions['timeformat'], $today['lastpost']);
$posttoday .= "<a href='search.php?do=finduser&u=$today[userid]' title='$wrdate' >";
if ($today[visible] == 2)
{
$posttoday .= $today['opentag'].$today[username].$today['closetag']."</a>*, ";
}
else
{
$posttoday .= $today['opentag'].$today[username].$today['closetag']."</a>, ";
}
}
}
if ($posttoday)
{
$posttoday = substr($posttoday, 0, strlen($posttoday)-2);
}
// ############# End of Who has posted today ###############

Paul M
03-26-2005, 12:51 PM
On both mods, The string:
WHERE lastactivity > " .$cutoff. " ORDER BY username" );

What the heck is the correct word to use (in place of username) if I want the names to be sorted by what time they logged in, instead of alphabetically?

Thanks-You need to use 'lastvisit' - however, you also need to add this field to the SELECT statement before it will work.

Paul M
03-26-2005, 12:52 PM
Maybe he has both of your mods just like me. I found that if the
Total members that have posted today
and the
Total users that have visited today

had both of their time set to reset at midnight (not rolling 24 hours) then one of them would not work, typically the Total users that have visited today one. ( Is this because of where it's placed in reference to the other?

So I changed one to show the rolling 24 hours, and the other was just on regular time, and they both started working.

At least that's how it appeared on this end.There is no reason both should not work, they do here. :) I did make a small change to the way the midnight cutoff is calculated a while back - you need v1.40 of the 'last visited' and v1.50 of the 'last posted' to pickup this change.

Julie
03-28-2005, 11:53 AM
Hm, I didn't reply to this one!

Lol, just have to say I did one NEWBIE'ish thing on this one... I couldn't understand why it didn't work, but.. lol, I had forgotten to upload the index.php ... *bangs head in keyboard*

But, great hack! Works like a charm (as soon as you upload the index.php :P) Thanks! :)

sim tech
03-28-2005, 02:56 PM
You need to use 'lastvisit' - however, you also need to add this field to the SELECT statement before it will work.


Thank you sir. The SELECT part is what I got burned on!

trilOByte
03-31-2005, 07:52 PM
Hi Paul, great hack - quick question though. I also have (had) your who's in chat for flashchat installed, but intstalling this munged the if conditional in the forumhome template. Any idea how to amend the template to allow both to work?

Thanks.

Paul M
03-31-2005, 08:43 PM
Not sure what you mean - but I have both installed - this is what the relevant section looks like;


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

<!-- who's in flashchat -->
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_chatusers')"><img id="collapseimg_forumhome_chatusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_chatusers].gif" alt="" border="0" /></a>
Members currently in the Chat: $totalchatters
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_chatusers" style="$vbcollapse[collapseobj_forumhome_chatusers]">
<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">$chatters</div></td>
</tr>
</tbody>
<!-- end who's in flashchat -->

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


HTH.

trilOByte
03-31-2005, 09:08 PM
My own fault, I have a stray closing tag for a conditional and couldn't see what was going on. Thanks for your help. Both additions are great.

/me clicks install.