Yeah my first hack for vb2.2.7 but then again its compatible with vb2.2.6 as well tested on both
What does this hack do? Just as the title states it calculates the total time online for each user
Configurable::
The time limit before a user is considered inactive is configurable and is included in the install txt file... so if you want a user to be defined as inactive after 3 minutes then there'll be a variable in the script to limit that configure that
Also Configurable is the amount of users to show per page on the leader time online board That is also configurable in the timeonline.php included with the zip...
Features ::
Includes both viewable on the postbit and getinfo templates...
Includes a leader board for the top users time online
What to do? ::
Queries to Run (1)
File Modification (5)
Template Modificatiion (2)
Templates to Add (3)
Files to Upload (1) :: [ timeonline.php ] (forum directory)
It's an easy hack to install (took me a little time to configure) but it looks great imo... probably a hack that will use and that i can see every forum having... why not right Enjoy yet another release... And if you like this hack i would be greatful if you could click install thanks...
Note ::
If for some odd reason you get a division by zero error
find:
PHP Code:
$daysreg = floor((time() - $lead[2]) / 86400);
$daysreg = iif($daysreg == 0,'1','$daysreg'); // checking to see if not registered for more then a day to prevent division by zero
$dotimeperday = floor($lead[3] / $daysreg);
replace with:
PHP Code:
$daysregs = floor((time() - $lead[2]) / 86400);
if($daysregs == 0) { // checking to see if not registered for more then a day to prevent division by zero
$daysreg = 1;
} else {
$daysreg = $daysregs;
}
$dotimeperday = floor($lead[3] / $daysreg);
g-force2k2
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");
replace with:
PHP Code:
if($bbuserinfo[usergroupid] != 6) {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user
WHERE usergroupid != 6");
} else {
$totalusers = $DB_site->query_first("
SELECT COUNT(*) AS users
FROM user");
}
then find:
PHP Code:
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
ORDER by timeonline DESC LIMIT $startat,$perpage");
replace with:
PHP Code:
if($bbuserinfo[usergroupid] != 6) {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
WHERE usergroupid != 6
ORDER by timeonline DESC LIMIT $startat,$perpage");
} else {
$leadtime = $DB_site->query("
SELECT userid, username, joindate, timeonline
FROM user
ORDER by timeonline DESC LIMIT $startat,$perpage");
}
Haven't tested it yet Kmaster.... but give it a shot regards...
Originally posted by LouChipher Is it possible to add a history for every day with the top30 online users (very active guest possible, too)? and the day average, since instal the hack, new member from register date...
Louchipher not exactly sure what you mean... if you're talking about making up for lost time i posted a fix on post#71 you can just call the time() function in any php file and echo it to see what time to use as your install time... then just replace the time...
But if you mean like a day by day stats...like top 30 usersonline today would be a tougher hack... yet not saying its not possible but would probably require more queries and such... regards...