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.
Love the idea of the hack but i dont want it to display the amount of time online anywhere except when i rollover a users name in the whos online box on the main forum page or on the whosonline page. How would i go about doing this? Thanks.
$totalquery = "ALTER TABLE user ADD timeonline int(10) NOT NULL DEFAULT '0'";
$DB_site->query($totalquery);
echo "Query successful.<br>";
echo "<font face='Courier New' size='1'>$totalquery</font><br><br>";
echo "Do not forget to delete this file...";
cpfooter();
?>
Upload it to your admincp, run the file, and then delete it. This will run the query directly through the admin cp, therefore bypassing any need for phpMyadmin or any other query running program, although, I highly recommend getting phpMyadmin or one of the several Query DB hacks floating around.
Originally posted by N9ne How could I make it so if you're in usergroupid=X and you are invisible, the time is not added on?
have not do this yet but i added an option in usercp edit option where user can choose whether to display their total time online or not
the default is on but if they select no, total time online will be disappear in all (include in their profile(or getinfo), time learder, and their posts) and only usergroupid ==6 can view all user's timeonline even if they disable it in their usercp.
even if they disable timeonline in their usercp, their time still adding.
What if I dont want to show the days? How would I need to modify the code? I just want it to continue counting the hours. and if possible to stop counting seconds when it reaches 24 hours.
I have Start the Tool now, an now is Linuxtime=1030666140 - also my Code is
PHP Code:
$daysregs = floor((time() - 1030666140) / 86400);
And don?t look on my bad english - first learn german :lick:
Thanks, this works well on my forum. The 'time online per day' was starting from when my forum first opened so the values were very low, but this sorted it out.
Not sure but it doesn't look like this hack caused that particular problem. I remember there was a hack that allowed you to play a midi file in your profile. It looks like, from the SQL statement, that this table is missing.
Perhaps you were installing this hack at the same time or didn't include the query from that hack and have never been to the profile since its installation?
Quote:
04-22-03 at 04:14 AM kdog316 said this in Post #267 when i try to go to my profile i get this erorr
Database error in vBulletin 2.3.0:
Invalid SQL: SELECT * FROM storeextra WHERE action='midi' AND userid='1'
mysql error: Table 'kdog316_vb.storeextra' doesn't exist
I realy dont want to install this hack for 2 reasons....
1) I dont want my members to suddenly leave the site if they realise they have been there for some time.
2) My wife will fill me cos she will know exactly how much time is spend working on the site