PDA

View Full Version : Who viewed this thread?


Johannes de León
30 Jun 2005, 21:21
This is a port of: http://www.vbulletin.org/forum/showthread.php?t=61222
(ported with permission)

Who viewed this thread?
This hack shows who has viewed any thread. View the screenshot to see how it looks.

Details
1 Query
1 New Phrase
1 Template Edit
1 Plugin XML

Screenshots
Available here (http://www.vbulletin.org/forum/attachment.php?attachmentid=16675), though now the box appears below the Current Active Users instead of above the post reply button, and it is not collapsible anymore.

Credits
Gary King, for allowing me to port his hack.

-----------

Instructions

Run query

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



Create new phrase
already_viewed_this_thread / Already viewed this thread:

Edit template
Open SHOWTHREAD and find:


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


Below this add:


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



Plugin
Just upload it, and it's all done.

Options
If you want to have invisible users in the list, go to the plugin manager, click edit to edit this plugin then add this to the beginning:


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

.Tim
30 Jun 2005, 22:04
Thanks! Great hack, been waiting for this one a while. Will have a lot of happy users now.
Is there anyway to add the time read to this?

Like it is in this one:

http://www.vbulletin.org/forum/showthread.php?t=61225

Johannes de León
30 Jun 2005, 22:58
Thanks! Great hack, been waiting for this one a while. Will have a lot of happy users now.
Is there anyway to add the time read to this?

Like it is in this one:

http://www.vbulletin.org/forum/showthread.php?t=61225
I'll see what I can do. :)

Chris M
30 Jun 2005, 23:11
While this is a nice idea, I have to worry about the performance issues associated with this on a large board - Potentially every user could have viewed it, and with a large board which is active the likelyhood of causing performance issues is greatly increased :ermm:

Satan

Loki12
01 Jul 2005, 12:09
Excellent Johannes! I will install when I get home tonight ... :D

welo
12 Aug 2005, 09:41
While this is a nice idea, I have to worry about the performance issues associated with this on a large board - Potentially every user could have viewed it, and with a large board which is active the likelyhood of causing performance issues is greatly increased

This will create a performance hit if you allow everyone access to it (especially guests). However, you can restrict the usergroups who can see the "who viewed" box (thus eliminating uneccessary queries) by wrapping all the injected template code in an <if> statement:



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



...will restrict viewing only to admins and mods. Add other usergroups at your discretion.

Installed, and thanks. :up:

Marco van Herwaarden
12 Aug 2005, 11:35
This will create a performance hit if you allow everyone access to it (especially guests). However, you can restrict the usergroups who can see the "who viewed" box (thus eliminating uneccessary queries) by wrapping all the injected template code in an <if> statement:
Putting a condition in the template will not stop queries from being executed. Limiting guests, will not have any influence on performance.

welo
12 Aug 2005, 12:31
Okay, replies like that, especially from a moderator, just irk the hell out of me. If you're going to slap down my solution you'd better have one handy that works, or at least tell me why mine won't. If a template condition doesn't render then no query is executed. If you prove me wrong I'll gladly apologize.

Marco van Herwaarden
12 Aug 2005, 12:54
Simple, this is in general how things work (and don't see it as slapping down, just don't always have the time to give a more extended asnwer):
- PHP Script is run
- Logic of the script is followed
- Script will retrieve all needed information from the database and place the information in variables.
- Once all info is available, the script will evaluate a template, in which the variables get replaced by their values.

As you see a condition placed in a template, only effect what is displayed, not what is retrieved from the database.

I can't give you an alternative solution, because i never even looked into this hack. But if you want to improve performance by excluding guests, you will have to edit the PHP-script to make that it will not query the database if a guest is viewing.

Wordplay
18 Aug 2005, 21:36
just showing my appriciation for the hack, installed! thank you for making it.

poolking
19 Aug 2005, 05:57
Okay, replies like that, especially from a moderator, just irk the hell out of me. If you're going to slap down my solution you'd better have one handy that works, or at least tell me why mine won't. If a template condition doesn't render then no query is executed. If you prove me wrong I'll gladly apologize.

Sorry to drag this up but I don't find anything wrong with his initial response. :ermm:

welo
19 Aug 2005, 06:08
Then quit dragging it up. Marco, thanks for clarifying.

mrsbuzzy
02 Sep 2005, 02:14
Hi just wondering if there was any resolution as to a way to get the time viewed next to the name?

.Tim
02 Sep 2005, 02:28
Hi just wondering if there was any resolution as to a way to get the time viewed next to the name?

Yeah, I'd really like it if we could have that feature. :D

poolking
02 Sep 2005, 05:26
Could you tell me whats the point in having the time next to the members name?

mrsbuzzy
02 Sep 2005, 12:08
I have moderators who are expected to respond to threads on their forum. If I see that one has read it hours ago but not replied I take note, if that happens repeatedly I talk with the moderator to see if the subject they host is over their head. I run a medical support site.

Bhuwan
22 Sep 2005, 01:00
any way to make it count the # who've viewd it ?

Bhuwan
25 Sep 2005, 13:52
Could you please add the text markup for a user name??? pretty please

KidneyBoy
29 Sep 2005, 18:05
I'm trying to use it on the final version, but it's not working. Is it just me that's having this problem? After visiting the page a 2nd time, I get an error message, and can't view the post. But when I remove the plug, I can visit the post.

ToastBusters
02 Oct 2005, 20:01
I'm having a problem with it on gold as well. Methinks it isn't compatible.

mrsbuzzy
02 Oct 2005, 20:19
I'm using it on 3.5.0 Release Candidate 2 without any problems.

.Tim
02 Oct 2005, 20:31
I'm having a problem with it on gold as well. Methinks it isn't compatible.

Works just fine for me.

KidneyBoy
02 Oct 2005, 20:59
Yeah, but unless you have updated your site, you are showing that you are using RC3. It's not working under GOLD--At least not for me. It gives me an error when I re-visit the post (the first time I visit the post, it's fine, but the 2nd time, it's not)

.Tim
02 Oct 2005, 21:55
Yeah, but unless you have updated your site, you are showing that you are using RC3. It's not working under GOLD--At least not for me. It gives me an error when I re-visit the post (the first time I visit the post, it's fine, but the 2nd time, it's not)

Oh yeah, my profile is wrong. I'm using gold on my site.

vibe
09 Oct 2005, 08:38
installed

Markco
10 Oct 2005, 05:48
I'm trying to use it on the final version, but it's not working. Is it just me that's having this problem? After visiting the page a 2nd time, I get an error message, and can't view the post. But when I remove the plug, I can visit the post.
Yes i have similar problème the error is:
Fatal error: Cannot use object of type vB_Session as array in /showthread.php(1903) : eval()'d code on line 33

vktechnology
11 Oct 2005, 08:11
doesn't work for me on = vb 3.5 Gold
I've got blank page when click on showthread

GrendelKhan{TSU
11 Oct 2005, 08:21
thanks!!

/me installs (vb 3.5.0 Gold)

microzott
12 Oct 2005, 07:21
installed on Vb 3.5.0 Gold with no problems, but i still have VB3.0.9 on line... :)
the only change i would like to suggest is to includte the day and time of the last viewed (another hack for 3.0.X had it).
do you think is possible?

thanks

.Tim
12 Oct 2005, 22:20
Yes, I agree, the date and time would be great to have.

Rocol
17 Oct 2005, 13:26
Is there any way that the names of those that have viewed the thread, can be placed at the top of the thread, rather than at the bottom please ;)

TMM-TT
18 Oct 2005, 14:54
Could you tell me whats the point in having the time next to the members name?


I've noticed that this function does'nt work with the gold version. But the problem seem to be easy resolved. :)

In the plugin php code, change this line (sessions):



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




to this line:



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




.. then it works again. :)

mrsbuzzy
18 Oct 2005, 15:47
Is this to allow the hack to work in gold, or does it add the time stamp?

I've noticed that this function does'nt work with the gold version. But the problem seem to be easy resolved. :)

In the plugin php code, change this line (sessions):



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




to this line:



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




.. then it works again. :)

Mastar
19 Oct 2005, 03:56
Like a charm and Clicked install!!

cmiller1014
23 Oct 2005, 02:57
This is EXACTLY what I need guys! Quick question....

Will it work with 3.5 gold, and what code would I wrap around it to show it ONLY to a certain usergroup, and ONLY in a certain forum.

Basically I only want this to show up for my advertisers, and only in the advertising forum so they can see who viewed their ads.

Thanks a ton!

klaush
24 Oct 2005, 19:18
Any idea? Using 3.5 gold:

parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /srv/www/xxx/xxx/vbulletin/showthread.php(1903) : eval()'d code on line 34

Thanks for your help!

steadicamop
18 Nov 2005, 17:58
Installed fine on 3.5.1 - no problems quick install and works well, although doesn't show usergroup types (red = admin etc, but that doesn't matter!)

Thanks!!

aranthorn
18 Nov 2005, 23:55
no problems in vb3.5 gold

shama
19 Nov 2005, 04:20
I will try this one and I hope it works with me :)

aranthorn
05 Dec 2005, 20:30
Had to un-install, way too much load with 100+ users on line.

xml
08 Dec 2005, 22:50
i have 300+ users online ....could this plugin cuz high load?

bryanb
14 Dec 2005, 12:33
This will create a performance hit if you allow everyone access to it (especially guests). However, you can restrict the usergroups who can see the "who viewed" box (thus eliminating uneccessary queries) by wrapping all the injected template code in an <if> statement:...
Is there a script you could turn me on to that allows this to be viewed by forum members who have reached a certain "reputation" level only? Like 150+? Thanks in advance! :)

bashy
14 Dec 2005, 12:52
Where would this be put please?

Bashy

This will create a performance hit if you allow everyone access to it (especially guests). However, you can restrict the usergroups who can see the "who viewed" box (thus eliminating uneccessary queries) by wrapping all the injected template code in an <if> statement:



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



...will restrict viewing only to admins and mods. Add other usergroups at your discretion.

Installed, and thanks. :up:

bryanb
14 Dec 2005, 16:09
I'm pretty much a newbie with phpMyadmin. When I submited the query I received this:

You have to choose at least one Column to display
What now? :ermm:

I'm running the most recent version - 2.7.0-pl1.

bryanb
16 Dec 2005, 06:34
I'm pretty much a newbie with phpMyadmin. When I submited the query I received this:


What now? :ermm:

I'm running the most recent version - 2.7.0-pl1.
If anyone can help me on this, I'd really appreciate it. Thanks!!

bryanb
27 Dec 2005, 21:26
If anybody can point me into the right direction, I'd really appreciate it. Thanks in advance!

vietkieu_cz
05 Jan 2006, 19:10
I need this hack for only some Forum (some thread), not for all forums (not all threads), can I help me?

ForeverForums
10 Jan 2006, 19:06
i got this working flawless in 3.5.2

*installs*

AraServ
22 Jan 2006, 00:24
i can't make it work on 3.5.3 !!!

Silvio
23 Jan 2006, 16:15
Working smoothly on 3.5.3 *installed*


Is there the possibility to have more options than the very usefull Hidden user one?

---> avoid showing admins and/or mods?

ty and regards

bkaul
17 Feb 2006, 06:03
I've noticed that this function does'nt work with the gold version. But the problem seem to be easy resolved. :)

In the plugin php code, change this line (sessions):
I had to do this to get it working in 3.5.3

Just a thought... wonder if it'd be possible to use the database info that's already there for each user for new post searches, etc. to retroactively add viewed data to existing threads...

BabyNameAddict
05 Mar 2006, 14:59
I have 3.5.4. I followed the steps with no errors, but I also can't see who viewed the thread. Any ideas?

BabyNameAddict
05 Mar 2006, 15:07
Wait, I think I see it now. I was expecting it to be under the "views" where it shows how many viewed the post. But I see it's now on the bottom of a thread once you open it.

:)

BabyNameAddict
06 Mar 2006, 00:38
Just wanted to add: great job! I clicked *Install* and gave the thread a 5 Star rating :nervous:

kall
13 Jul 2006, 05:34
Yes i have similar problème the error is:
This appears to be an error if you are using PHP5.

Cannot view threads, as the following error is displayed, and that is all.


Fatal error: Cannot use object of type vB_Session as array in /***/***/***/***/showthread.php(1912) : eval()'d code on line 35


Disabling the showthread plugin stops the error, but obviously breaks the hack.

Does anyone have any idea how to resolve this?

Whiterook
30 Jul 2006, 19:15
Installed, and working just fine, thank you.

I do have a question on the following script enhancement.
Welo included the following:
This will create a performance hit if you allow everyone access to it (especially guests). However, you can restrict the usergroups who can see the "who viewed" box (thus eliminating uneccessary queries) by wrapping all the injected template code in an <if> statement:



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



...will restrict viewing only to admins and mods. Add other usergroups at your discretion.



My question is on wrapping the injected template code with the above <if statement.

Where do I add this code?

Pretty much the same thing Bashy asked, but wasn't answered. Good to know I'm not the only one with this question... some what of a disclaimer :D

Thank You in advance,
WR

Muellmann
30 Jul 2006, 20:59
I need this hack for only some Forum (some thread), not for all forums (not all threads), can I help me?

exclude by forum-ID in that way:
visible in forums 2, 3, 4:
<if condition="in_array($forumid, array(2, 3, 4))">
<!-- Code of this Hack -->
</if>

djjeffa
02 Nov 2006, 04:01
is this out for 3.6.1 ?
and is ther a way to make this an option for certin threads to knock the load down on big sites?

Cloud Strife
05 Apr 2007, 19:33
After upgrading to mySQL 5 I get this error with the plugin:-

Fatal error: Cannot use object of type vB_Session as array in /home/siteupload/public_html/forums/showthread.php(1953) : eval()'d code on line 33

RedGTiVR6
11 Jul 2007, 22:19
exclude by forum-ID in that way:
visible in forums 2, 3, 4:
<if condition="in_array($forumid, array(2, 3, 4))">
<!-- Code of this Hack -->
</if>

Thanks!

This is exactly what I was looking for!

I only wanted this to show in our bug reporting forums so I can keep tabs on our QA team and to let our customers know if the QA team has read the bug report.

I'm off to try and install this on 3.6.7PL1.

:D

RedGTiVR6
11 Jul 2007, 23:40
Fatal error: Cannot use object of type vB_Session as array in /xxxxx/public_html/vbulletin/showthread.php(1963) : eval()'d code on line 111

Any ideas anyone? Even though this mod isn't supported....:(

ahmedeldeep
30 Jul 2007, 01:16
i need this mod but i cant run it on php5
plz quick help

ahmedeldeep
30 Jul 2007, 18:38
plz help

HossMon
31 Dec 2008, 05:09
I was able to get this working on v 3.7.4 BUT only if your using PHP 4.x I'm working on editing the array calls for PHP 5 and will update post if I ever suss it out.
But, It must be installed as a plugin. Do not import the xml file!
This also works on my v3.6.9 board as well.

As this is my first "real" contribution to vB.org, I hope that by attaching the instructions I created I'm breaking no rules nor offending the original author!
It is a minor change to the original installation.

Download the instructions attached and give it a go. I take no responsibility if it screws up your forums. I'm just attempting to be helpful. DO backup your database first please!

If anybody finds any fault with these instructions. Please feel free to edit and repost them.

An additional note....

If you use the optional line
<if condition="in_array($bbuserinfo['usergroupid'],array(5,6,7))">
to control you can use this Mod...
make sure the extra </if> statement following the phrase <!-- end currently active users -->
exisits when editing the SHOWTHREAD template. This </if> is included in the paste text of my instructions.

If you chose not to use this line, I do not believe it needs to be included.



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



And make sure there is also an </if> statement either before or after <!-- end who viewed this thread -->
Before saving and reloading the template.
Again last line should be as follows...



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



I hope that makes sense to everyone. It's late and I've been at it for a while!