vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   [VB3 RC3] Board Spent Time (https://vborg.vbsupport.ru/showthread.php?t=60488)

Kentaurus 01-19-2004 10:00 PM

[VB3 RC3] Board Spent Time
 
This hack keeps track of how much time a user has been online at the
forums and adds it to the information in any of his posts, then any
other user can see if you have been 1 hour, 5 hours, 1 day or even up
to years online at the forum.

Also this hack calculates an "average time online" in a very similar way to
how the average posts works.

Thanks to the people that suggested this hack in the request forum, it is
a really nice one and a very fun one too!

Keep in mind this hack will only start tracking the time that you are online once you install it, it has no way of knowing how much time you had been on the forums before.


*Update*: You can show the board spent time in your memberlist, then you can use your memberlist as a leaderboard. For this modification see this post: https://vborg.vbsupport.ru/showpost....6&postcount=50


Info for hackers:
You may modify, improve, upgrade, redistribute this hack, include it
in another hack or yours or translate it provided you do it free of
charge and you distribute it in www.vbulletin.org at least, there is no
need to pm me asking for permission
Some portions of the code are (c) Jelsoft Enterprises Ltd.

eXtremeTim 01-19-2004 11:32 PM

Was waiting for this one. Does this track the total time on site or just when in forums since your text says time in forums.

Kentaurus 01-19-2004 11:35 PM

Quote:

Originally Posted by eXtremeTim
Was waiting for this one. Does this track the total time on site or just when in forums since your text says time in forums.

If your site uses the forum engine (it includes global.php to make queries and such) then it will track the total time on site. Otherwise if the rest of the site is just static html or any other news/articles program it has no way of tracking time spent.

eXtremeTim 01-19-2004 11:40 PM

by site i ment the whole of the board ;)

Kentaurus 01-19-2004 11:41 PM

Quote:

Originally Posted by eXtremeTim
by site i ment the whole of the board ;)

Oh. Yes, it keeps track of everywhere. Forums, Threads, Usercp, private messages... actually everything.

eXtremeTim 01-19-2004 11:50 PM

Hey can you make this say second minutes and hours ect instead of just one of them?

Kentaurus 01-19-2004 11:57 PM

Quote:

Originally Posted by eXtremeTim
Hey can you make this say second minutes and hours ect instead of just one of them?

that's what it does already. My screenshot only shows minutes but that is only an example. It goes seconds-minutes-hours-days-weeks-months and up to years, although I have yet to see someone that spent a complete year of his life in a forum.

eXtremeTim 01-19-2004 11:59 PM

No i mean like

Time online: 1 minute, 34 seconds

or 3 weeks, 4 days, 2 hours, 1 minute, 23 seconds

or something along thoose lines like this hack for vb2 did.

Kentaurus 01-20-2004 12:02 AM

Quote:

Originally Posted by eXtremeTim
No i mean like

Time online: 1 minute, 34 seconds

or 3 weeks, 4 days, 2 hours, 1 minute, 23 seconds

or something along thoose lines like this hack for vb2 did.

Seems like I am not getting your questions :) I should read more carefully.

Yes, it can be done. That's a little too specific for my needs but should be a simple change. I really didn't check on the hack for vb2 so I only went with what people were asking for in the request forum. I'll look into it.

eXtremeTim 01-20-2004 12:06 AM

Thanks man i would really love to have it like that.

aloha 01-20-2004 12:10 AM

How would you exempt the moderators and admins from this?

Gio Takahashi 01-20-2004 12:15 AM

How often is the timer supposed to update?

Kentaurus 01-20-2004 12:33 AM

Quote:

Originally Posted by eXtremeTim
Thanks man i would really love to have it like that.

.txt updated and added one screenshot. It was a small change in effect :)

Quote:

How would you exempt the moderators and admins from this?
There are two ways to do it: you can either disable logging for the moderators and adminstrators (it would require further hacking), or just don't display it. If your administrator usergroup is 6 and your moderator's is 5 you can add a template conditional:

<if condition="$post[usergroupid] != 6 AND $post[usergroupid] != 5">
Your code here for printing the board spent time, $post[timespent]
</if>

Then you would only display the time spent in the board for non-moderators and administrators.

Quote:

How often is the timer supposed to update?
It keeps updating as long as you are browsing the board. Whenever you click on a hyperlink and browse another page it updates the time spent in the forum. If you don't have any activity in the forum in the same time setting that you have for your cookie expire options in the admin control panel then it stop recording the board spent time and whenever you log in/open the forum again it starts adding to the time again.

Gio Takahashi 01-20-2004 12:50 AM

I meant the post bit. on my forums, the timer has yet to update, everyone's timer says "< 1 sec"

eXtremeTim 01-20-2004 12:52 AM

Wicked dude. Any chance you can make an online leaderboard? Kinda like memberlist but shows user name posts and time online and is sorted by greatest time online?

Kentaurus 01-20-2004 12:54 AM

Quote:

Originally Posted by Gio Takahashi
I meant the post bit. on my forums, the timer has yet to update, everyone's timer says "< 1 sec"

Did you run the query in the instructions? (phpmyadmin or admincp)

Code:

alter table user add timespent int not null;
If you forget to run that query the forum doesn't give you any error, it just shows < 1 sec all the time.

MGM 01-20-2004 02:18 AM

nice hack! I used the one for vB2, ill use this for vB3 as well ;)

[high]* MGM clicks Install
[/high]

MGM out

Boofo 01-20-2004 04:11 AM

What if i just want to put this in the memberinfo template and nowhere else. Do I still need to addd all of the code?

Anarchy 01-20-2004 04:19 AM

A leader board would be great, i would love a leader board.!

Kentaurus 01-20-2004 08:24 AM

Quote:

Originally Posted by Boofo
What if i just want to put this in the memberinfo template and nowhere else. Do I still need to addd all of the code?

If you only want it in the memberinfo template you can skip the file modifications in showthread.php

GamerzWorld 01-20-2004 09:22 AM

Im getting same. I just checked in phpmyadmin and it said i did have the collumn added so not that

Ronin 01-20-2004 09:25 AM

I am also having the same issue. Doesn't seem to be updating. I ran the query. I even removed the entry and ran it again. Same thing. I double checked all the edits for the files and templates the phrases are there as well. But still no go! :(

GamerzWorld 01-20-2004 09:42 AM

Has any body actually got this working ... lol

infernonet 01-20-2004 10:06 AM

thanks nice hack good work :)

MrNase 01-20-2004 10:58 AM

Does it count from the day the hack was build in or will this hack display the online time from the opening of the board till now?

Kentaurus 01-20-2004 12:42 PM

Quote:

Originally Posted by Ronin
I am also having the same issue. Doesn't seem to be updating. I ran the query. I even removed the entry and ran it again. Same thing. I double checked all the edits for the files and templates the phrases are there as well. But still no go! :(

I have tested it in at least 3 boards and it seems to be working. Did you make the changes in sessions.php? That could be the only reason it is not updating. In sessions.php.

In sessions.php this query:

Code:

$DB_site->shutdown_query("
        UPDATE " . TABLE_PREFIX . "user
        SET lastactivity = " . TIMENOW . "
        WHERE userid = $bbuserinfo[userid]
", 'lastvisit');

is changed to

Code:

                                $timespent = TIMENOW - $session['lastactivity'];                                               
$DB_site->shutdown_query("
        UPDATE " . TABLE_PREFIX . "user
        SET lastactivity = " . TIMENOW . ",
                                                                timespent=timespent+$timespent
        WHERE userid = $bbuserinfo[userid]
", 'lastvisit');

make sure it is that exact code you change, some lines above that there is another one that looks alike but also modifies lastvisit. (that is in the instructions already, it is not something new).


Gio Takahashi, did you do anything special besides the instructions? It seems to be working on your board.

GamerzWorld 01-20-2004 02:23 PM

Is it possible you could upload your session.php id change it to match my arcade hack but itd eliminate that...

MrNase 01-20-2004 02:31 PM

Quote:

Originally Posted by MrNase
Does it count from the day the hack was build in or will this hack display the online time from the opening of the board till now?

:nervous::banana:

GamerzWorld 01-20-2004 03:11 PM

Fixed and to answer your question Nase it starts when you install the hqack

HiDeo 01-20-2004 03:40 PM

Thanks I download and install now

FleaBag 01-20-2004 04:59 PM

Very nice hack, should give my users something to talk about.

Anarchy 01-21-2004 02:24 AM

Leader Board not a good idea?

Kentaurus 01-21-2004 08:38 AM

Actually it's a good idea.

I would like to know if you want it into the memberlist (you see an extra "time spent" column in memberlist and can sort by it) or as a separate page.

Anarchy 01-21-2004 08:49 AM

It would be great if it were accessable in the members list and then you could be able to sort by it.

GamerzWorld 01-21-2004 02:50 PM

The Average time didnt work when i installed vb 3 Cand 3

Kentaurus 01-21-2004 03:19 PM

Quote:

Originally Posted by GamerzWorld
The Average time didnt work when i installed vb 3 Cand 3

I have to re-check all my hacks for RC3. If there is the need for any modification I'll post it in the proper thread.

mharmon 01-21-2004 04:57 PM

I also had trouble with this hack on my VB3 RC2 board. It shows Average Time <1 Sec.

How would I go about deleting the time spent entry in my database and then trying again?

What query would I run to do this?

Kentaurus 01-21-2004 05:22 PM

Quote:

Originally Posted by mharmon
I also had trouble with this hack on my VB3 RC2 board. It shows Average Time <1 Sec.

How would I go about deleting the time spent entry in my database and then trying again?

What query would I run to do this?

Code:

UPDATE user SET timespent=0
this resets the time spent in the board for all users to 0. If this query gives you any error it is because the column was never added to the user table.

gmarik 01-21-2004 05:24 PM

Spent all the time in the world :) thanks

mharmon 01-21-2004 06:04 PM

kentaurus ---

thanks for ther quick reply. I did that query and it didn't give me an error -- although now it still says <1 for both entries on the site.

any suggestions?


All times are GMT. The time now is 04:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01595 seconds
  • Memory Usage 1,818KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete