PDA

View Full Version : [VB3 RC3] Who viewed this thread?


Kentaurus
06 Feb 2004, 05:28
I know there is already one version of this by Gary W but I already made (and documented) my own so I thought I would post it.

Advantages of my hack:

My hack adds only 1 query to showthread, and it only queries the user table, so it is less server intensive. That is important to any busy board or anyone that wants to save some resources. It integrates with the "thread views" system to update the people that have seen the thread.

Disadvantages:

Well.. with mine even if you browse the forum as "invisible" you would end up showing in the "who read" list.


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.

Boofo
06 Feb 2004, 05:32
Looks good. I trust how you support your hacks much more than the other one. ;)

*arie
06 Feb 2004, 06:14
cool. :)

any way to limit the view only to admins?

gmarik
06 Feb 2004, 10:44
Great. Could it be that the add-on who downloaded this attachment would be combined with this?

Kentaurus
06 Feb 2004, 17:45
cool. :)

any way to limit the view only to admins?in the template showthread, this:


<if condition="$+++++ad">
<table cellpadding="10" cellspacing="0" border="1" width="100%">
<tr valign="top">
<td class="alt1">Users that have seen this thread: <b>$+++++ad</b></td></tr></table><br/>
</if>
replace it white:


<if condition="$+++++ad and $bbuserinfo[usergroupid]==6">
<table cellpadding="10" cellspacing="0" border="1" width="100%">
<tr valign="top">
<td class="alt1">Users that have seen this thread: <b>$+++++ad</b></td></tr></table><br/>
</if>

Then only admins would be able to view it



those '+' are a w h o r e a d, seems that the forum is censoring it.

Kentaurus
06 Feb 2004, 17:49
Great. Could it be that the add-on who downloaded this attachment would be combined with this?
Do you mean Rein's Who Downloaded? It shouldn't be any problem if both hacks are installed.

Kentaurus
06 Feb 2004, 18:23
An update for this hack:

With this modification the "who viewed" list will be ordered alfabetically, the original behaviour was to order the users as they saw the thread, but that's not very reliable. Apply this modification only if you would like to see the list ordered.

search for this



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



replace that with


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



search for this



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



replace that with



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



TXT and HTL updated of course :)

And... all the +++++ are the word: w h o r e

the complete word is w h o r e a d
being censored

Allan
06 Feb 2004, 18:57
Thank you Kentaurus, very nice hack !

Boofo
07 Feb 2004, 06:17
Hey, buddy, I have a request. Is there a way to have the names follow the color and intensity (html mark-up, I think it is called) like Admins and Supermods and users and such? It would make it easier to identify with a quick glance as the list grows. ;)

And maybe the total numbers of members and guests (if they are allowe to read the threads like mine are) who have read the thread so far?

Boofo
07 Feb 2004, 06:57
The sorting feature doesn't seem to be working for me. I have me (Boofo) in the list, the next one strats with an M and the next one strats with an A. They are not going alphabetically. ;)

Kentaurus
07 Feb 2004, 07:26
The sorting feature doesn't seem to be working for me. I have me (Boofo) in the list, the next one strats with an M and the next one strats with an A. They are not going alphabetically. ;)The sort will only work in new threads or threads where the list needs to be updated, if the who viewed is already stored for a thread then it won't be sorted. Call it an insertion sort :) It only sorts when something is added.

I'll check for that username markup, shouldn't be that hard to modify, but keep in mind that a query is needed for that. It is not an update query so it shouldn't hurt a lot the performance but still for people that are trying to mantain queries to a minimum (like me) an extra query might not sound practical.

Kentaurus
07 Feb 2004, 08:04
Here is the first one. For people that already installed the hack and want to add how many users have seen the thread:

In the showthread.php file, this:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Replace it with:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



In the SHOWTHREAD template, this:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Replace it with:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Guests are a little more difficult because it means storing ip addreses as well instead of userid's. I'l check if there is an easy way to do it.

Those +++ are the word w h o r e that even if its a substring it is still being censored (/me makes a note on not using variable names that might be censored).

TXT file updated

Boofo
07 Feb 2004, 10:28
Is there any way to run a query to sort the users who have already seen a thread so it can strat off alphabetically from now on?

Can you just use the code in vBulletin for who is browsing this thread now to get the html markup that it is using already? ;)

squawell
07 Feb 2004, 11:18
i got this error when i run scheduled task in my admincp


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



the line 41 is


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


any idea?thankz

edit:delete the line 41 than it works:D

Kentaurus
07 Feb 2004, 20:51
i got this error when i run scheduled task in my admincp


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



the line 41 is


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


any idea?thankz

edit:delete the line 41 than it works:DDon't worry about it, it's a warning (it doesn't stop the code from executing), that's because some threads might not have any data to sort. If you really don't want to see the warning change it to this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Boofo
07 Feb 2004, 21:40
Here is the first one. For people that already installed the hack and want to add how many users have seen the thread:

In the showthread.php file, this:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Replace it with:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



In the SHOWTHREAD template, this:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Replace it with:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Guests are a little more difficult because it means storing ip addreses as well instead of userid's. I'l check if there is an easy way to do it.

Those +++ are the word w h o r e that even if its a substring it is still being censored (/me makes a note on not using variable names that might be censored).

TXT file updated
On guests, maybe just do a guest count?

Kentaurus
08 Feb 2004, 22:01
Here is another update

As requested by Boofo, to make the users appear with the html markup as they appear in the online users and almost anywhere, at the cost of 1 query.

I'm now attaching a txt since I'm getting tired of that censor.....

For threads before I added the sorting piece, just create a new user and view the unsorted thread, it will be sorted.

Boofo
08 Feb 2004, 22:08
That's Boofo, not Boofoo. ;)

And thank you, sir. ;)

Boofo
08 Feb 2004, 22:34
That worked great! Thank you, again. ;)

You forgot to add the space after the comma in this line. The names were all running together. But I fixed it on my site. ;)



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Boofo
09 Feb 2004, 02:57
Now I'm getting nothing but DB errors with this. I emailed you about it.

Kentaurus
09 Feb 2004, 03:18
Seems that there we some cases I didn't consider. I fixed it already and uploaded an updated txt. For the people that installed it please change:

(and there we go with this censor...)



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



to:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



it is already in the txt

Boofo
11 Feb 2004, 10:08
It still isn't sorting the names quite right. In that list of names I sent you in the email, the last name is still showing up out of order. Any way to fix that? ;)

Kentaurus
12 Feb 2004, 02:19
It still isn't sorting the names quite right. In that list of names I sent you in the email, the last name is still showing up out of order. Any way to fix that? ;)
Then I'll write a small script to sort them, just give me some time :)

WAR
12 Feb 2004, 02:44
were you planning on releasing an htl compliant version again at some point?
(I was going to wait until then if so)

Kentaurus
12 Feb 2004, 03:09
were you planning on releasing an htl compliant version again at some point?
(I was going to wait until then if so)
When HTL 1.1 is ready, maybe. It's just that editing both the HTL and the TXT is some time consuming.

Boofo
12 Feb 2004, 03:32
Then I'll write a small script to sort them, just give me some time :)
Ok, I'll be here waiting. ;)

Kentaurus
13 Feb 2004, 16:17
Ok, I'll be here waiting. ;)
It only happened with the colors highlight .... it was an "error" in the query (actually the order by was missing).



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



change it to


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



If that doesn't work take a broom and hit the hack... err.. I'll fix it again.

whoviewed_colors.txt updated also

Boofo
13 Feb 2004, 23:16
You can hold off on the broom. That fixed it. ;)Thank you kindly, sir. ;)

Alas-Digitales
14 Feb 2004, 17:44
Would be possible that the usersnames had a link to their profile?

Boofo
19 Mar 2004, 00:26
Yes, would it be possible to have the names linked to their profile? That would be excellent. ;)

Q8vbhacks
26 Mar 2004, 08:52
tahnks Kentaurus

can we use it to Specified forums .

weaver
28 Mar 2004, 18:38
I checked the code and I had some likes of ************* without any // in front of them. I got rid of those and there isn't an error, but I don't see any names of who has viewed the thread either.

**Sorry didn't realize it was at the top of the screen. I was looking for it at the bottom.

Catch-22|BL
15 Apr 2004, 13:27
Good work as always, Kentaurus!

Smooth install and does exactly as described. :)

JaNa
26 Apr 2004, 21:37
Useful!

/me Clicks Install

tccra
12 May 2004, 03:39
Is this working in 3.0.1? No error messages but the list isn't showing up in my thread view pages.


edit: changed "$bbuserinfo[usergroupid]==6" to "is_member_of($bbuserinfo, 6)" and voila! It worked.

DCX
12 May 2004, 07:12
Is this working in 3.0.1? No error messages but the list isn't showing up in my thread view pages.


edit: changed "$bbuserinfo[usergroupid]==6" to "is_member_of($bbuserinfo, 6)" and voila! It worked.


same thing as me. i even changed the template as stated above and it still doesn't work for me. and i did it for only admins....

DCX
12 May 2004, 08:56
k, it's workin for me now. guess it takes time to load up when the members actually go to those posts AFTER the hack has been installed.....

Carter876
12 May 2004, 15:41
Kentaurus compliments for your nice hack, I have a little question:
Is there the possibility to see the last date and time in which the user has read the post? (It's very important for me to know it)

Tnx in advance :)

Regards

DCX
12 May 2004, 17:30
ok, it is working for me but i have a little problem... for some reason, it's not showing up on ALL threads.... it is showing on a majority of the threads though. any ideas?

Grendel
13 May 2004, 19:56
How is that done, if I want to limit the view to thread-starters only? Any idea?

Kentaurus
16 May 2004, 10:32
Is this working in 3.0.1? No error messages but the list isn't showing up in my thread view pages.


edit: changed "$bbuserinfo[usergroupid]==6" to "is_member_of($bbuserinfo, 6)" and voila! It worked.

Please remember there is a setting in the ACP in the "Server Settings and Optimization" that reads "Update Thread Views Immediately", by default that is set to "no" and the thread views are updated only in an hourly basis, that would mean that also the whoviewed would be updated in an hourly basis :)

Kentaurus compliments for your nice hack, I have a little question:
Is there the possibility to see the last date and time in which the user has read the post? (It's very important for me to know it)


This can be done but it is a little server intensive... if I find a way of doing it without taking a lot of resources I'll add it.

ok, it is working for me but i have a little problem... for some reason, it's not showing up on ALL threads.... it is showing on a majority of the threads though. any ideas?

If a thread hasn't been seen by anyone then it doesn't appear. Of course, at least you have seen the thread, right. Then just wait an hour for it to be updated, or in the ACP change the setting for thread views to be updated immediately.

How is that done, if I want to limit the view to thread-starters only? Any idea?

In the hack, instead of

<if condition="$+++++ad">

use

<if condition="$+++++ad and $threadinfo[postuserid]==$bbuserinfo[userid]">

Kentaurus
16 May 2004, 11:17
You can now find in the first post a second version of this hack, the who viewed thread (with time) will show the last date a user viewed the thread, and also that version adds a link to the memberinfo.

If you were using the first version and you want the new features please uninstall the last version, you will need the following queries (please keep in mind you will loose the "who viewed" list for your threads):

ALTER TABLE thread DROP w h o r e a d;
ALTER TABLE threadviews DROP w h o r e a d i d;
ALTER TABLE threadviews DROP w h o r e a d n a m e;

Undo the file changes of the first version and install the second version of the hack.


If you are installing this version for the first time you should go straight for the most recent version. (who viewed thread with time)

Boofo
16 May 2004, 18:35
How would I go about making it so when you mouseover the name it shows the date and time instead of having it behind the name? If you get enough people viewing the thread, this list would get very long with the date and time behind each name. ;)

Kentaurus
17 May 2004, 06:18
How would I go about making it so when you mouseover the name it shows the date and time instead of having it behind the name? If you get enough people viewing the thread, this list would get very long with the date and time behind each name. ;)
It should be a template.. but right now it is hard-coded. In the hack:


$+++++ad .= "<a href=\"member.php?u=$whodata[userid]\">".fetch_musername($whodata)."</a> (".vbdate($vboptions['dateformat'], $+++++adarray[$whodata['userid']], true, true, false)." ".vbdate($vboptions['timeformat'], $+++++adarray[$whodata['userid']], true, true, false)."), ";


change it to:


$+++++ad .= "<a href=\"member.php?u=$whodata[userid]\" title=\"(".vbdate($vboptions['dateformat'], $+++++adarray[$whodata['userid']], true, true, false)." ".vbdate($vboptions['timeformat'], $+++++adarray[$whodata['userid']], true, true, false).")\">".fetch_musername($whodata)."</a> , ";

Boofo
17 May 2004, 08:55
Thank you, sir. ;)

Grendel
17 May 2004, 15:04
Thank you for your answer, Kentaurus.

Carter876
17 May 2004, 21:09
Wow really a good hack and a fantastic support :D
I have installed it and I wait the version that show the last time by the mousover the name ;)

Install for me

Carter876
29 May 2004, 11:52
Ehm I have another question :rolleyes: , the hack signals me the time of the server that is different from mine (I have + 3 hours from the time of the server), Is there the possibility to modify the code of the hack to add for example + 10800 seconds?

Tnx in advance

Regards :)

Carter876
30 May 2004, 08:49
Ok i Have modified the code, and now it works but I hope that someone tell me if this change is good or if I have compromised something in VB funtionality :rolleyes:


Before


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



After


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



As you can see I have added the numbero of seconds to fill the offset from server time and my time :)

Regards

weaver
31 May 2004, 03:43
Anyone know why (December 31st, 1969 07:00 PM) is showing up as the date/time I read the thread?

ETA: Okay now it has the proper date/time. Odd....

SaN-DeeP
11 Jun 2004, 04:32
Ok i have some serious issues, i wonder if someone else notice about this

My Server is located in US which mite have GMT - 8:00 timings
weras my forum timings and people are of india GMT + 5:30

Currently It is 9:02 AM here.
and i can see this thing when a user last viewed any particular thread
(Yesterday 07:15 PM)

Help me fix this please.

Thank You for nice hack.

Sandy...

Carter876
20 Jun 2004, 10:08
Is there news about this hack? :rolleyes:

Regards

Jadelit
29 Jul 2004, 12:32
bump

any help with the server and usertime would be grateful

SaN-DeeP
31 Jul 2004, 04:25
This hack adds 0 new queries and tries to be "server friendly".
Installation file says this.

But i had 12 queries in my postbit and postbit_leagacy before installing it and now it is 13 :)

Though i find it to be server friendly.

snake-boy
08 Aug 2004, 02:56
Is this working in V3.0.3 (yet)?

I would VERY much like to install this but don't want to be wasting my time.

Anyone who's running this successfully with 3.0.3, please say 'aye' :) ?

-snake

wi11ie1950
23 Oct 2004, 04:17
aye :):)

wi11ie1950
23 Oct 2004, 04:55
The mouseover change doesnt work for me no matter how i do it i get:-

Parse error: parse error, unexpected T_INC, expecting T_VARIABLE or '$'
in /home/wi11iec/public_html/forum/showthread.php on line 460

Do the $+++++ go in as well cause they are not in the text file ??

wi11ie1950
23 Oct 2004, 04:56
The mouseover change doesnt work for me no matter how i do it i get:-

Parse error: parse error, unexpected T_INC, expecting T_VARIABLE or '$'
in /home/wi11iec/public_html/forum/showthread.php on line 460

Do the $+++++ go in as well cause they are not in the text file ??

wi11ie1950
23 Oct 2004, 04:56
The mouseover change doesnt work for me no matter how i do it i get:-

Parse error: parse error, unexpected T_INC, expecting T_VARIABLE or '$'
in /home/wi11iec/public_html/forum/showthread.php on line 460

Do the $+++++ go in as well cause they are not in the text file ??

wi11ie1950
23 Oct 2004, 04:56
The mouseover change doesnt work for me no matter how i do it i get:-

Parse error: parse error, unexpected T_INC, expecting T_VARIABLE or '$'
in /home/wi11iec/public_html/forum/showthread.php on line 460

Do the $+++++ go in as well cause they are not in the text file ??

trackpads
24 Oct 2004, 00:32
This is a great hack but would be alot better if you could have the information on a separate page. For example, I have a thread that was 100,000 views and honestly have that on the bottom of every page would make it look horrible. but I would like it on other pages for sure so have a link (option per usergroup) would be perfect.

Thanks again,

-Jason

wi11ie1950
27 Oct 2004, 10:36
The mouseover change doesnt work for me no matter how i do it i get:-

Parse error: parse error, unexpected T_INC, expecting T_VARIABLE or '$'
in /home/wi11iec/public_html/forum/showthread.php on line 460

Do the $+++++ go in as well cause they are not in the text file ??

Ok i worked it out.. I guess the +++++ is from VBs censor considering it spells out w h o r e

It all works great now under 3.0.3 :):)

SaN-DeeP
27 Oct 2004, 12:10
Ok i have some serious issues, i wonder if someone else notice about this

My Server is located in US which mite have GMT - 8:00 timings
weras my forum timings and people are of india GMT + 5:30

Currently It is 9:02 AM here.
and i can see this thing when a user last viewed any particular thread
(Yesterday 07:15 PM)

Help me fix this please.

Thank You for nice hack.

Sandy...
any fix for this :) ?

thanks

wi11ie1950
30 Oct 2004, 03:32
Hi San from what i can see it doesnt use VB country and time settings so if you correct it for India then it will still be wrong for those outside india.
I used the hack to hide the date and time behind the name and show on mouseover :):)

sv1cec
18 Nov 2004, 08:21
Hi San from what i can see it doesnt use VB country and time settings so if you correct it for India then it will still be wrong for those outside india.
I used the hack to hide the date and time behind the name and show on mouseover :):)
I have the same problem with San, my server is located in USA, while all times are using Greece time. What puzzled me, was that the way the info is shown, using vbdate function, the time should have been correct.

So, I tried using this code:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



and it produces the correct time for my country. However, when it is called from the hack (admitedly with a different syntax, I have no idea what these 'true', and 'false' parameters do) , in showthread, it shows the wrong time.

So, I did some experimentation, and here is what I came up with. If you change the vbdate arguments used in the showthread, a little, you can have it show the proper time.

Change this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



to this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Or if you do not want to see "Today" or "Yesterday", but just a plain date and time, change the code to:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Here is a description of the vbdate function. The code is located in includes/functions.php



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Rgds
-----------
John

Morgalis
21 Nov 2004, 11:05
Hi there

I am installing this with your Mod Management tool, and I am running into a parse error.

vb 3.0.3

parse error - no details given - at the else in the last part of the paste


else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "threadviews (threadid)
VALUES (" . intval($threadinfo['threadid']) . ')'
);
}


Any suggestions?

VitroX
12 Jan 2005, 13:24
thanks sv1cec for your fix ...

now, is there a way the user list can get sorted first those who has replied and then those who doesnt?, I'm after a way to detect those who dont reply to threads and are only lurking, this could be a way to detect them and that would be very usefull for me.

Lottis
17 Jan 2005, 18:22
Anyone like to help me take the time away?

VitroX
20 Jan 2005, 15:00
Anyone like to help me take the time away?
yes, in modified showthread.php file for this hack, look for:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


and replace it for:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


that should remove the date time info.

James Collins
27 Jan 2005, 02:20
Is this working in V3.0.3 (yet)?

I would VERY much like to install this but don't want to be wasting my time.

Anyone who's running this successfully with 3.0.3, please say 'aye' :) ?

-snake

aye :)

in 3.05 as well (with patch)

tractor-beam
01 Feb 2005, 23:52
Right now I have installed this modification with the code that lets only the Administrator view the new stats. However, I've created a Managers Usergroup (ID=9) that I'd also like to have them see the stats. How would I modify this statement:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Would it be something like:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Thanks!

- Gerry

Pinkie
06 Feb 2005, 21:38
Thanx
Will try it if it also works for me :)

Spinball
03 Aug 2005, 19:12
This hack works nicely until you have threads with a couple of thousand member views and it gets really, really slow to view a thread.
Is there any way the viewers of a particular thread could optionally be opened in a new window by clicking a link at the top of SHOWTHREAD?

Mikecp421
16 Oct 2005, 00:08
nice, worked first time on VB 3.0.8

Mikecp421
16 Oct 2005, 17:24
hey can someone tell me what to add to this to allow supermods to also be able to view this? Thanks



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Dreiko
04 Dec 2005, 20:36
Will this hack be upgraded to 3.5? :)

Z@N@
17 Dec 2005, 09:36
Yes or for 3.5.2?

Please.

Z@N@
17 Dec 2005, 09:49
EDIT: Found it, right here -

http://www.vbulletin.org/forum/showthread.php?t=92339&highlight=downloaded

Mikecp421
27 Jan 2006, 20:32
nice good looking man!

Dj-BuZ
10 Feb 2006, 21:11
Can someone help me i did every thing ask but i dont see it...i have 3.0.12