View Full Version : Who viewed this thread?
Johannes de Le?n
06-29-2005, 10:00 PM
This is a port of: https://vborg.vbsupport.ru/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 (https://vborg.vbsupport.ru/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 ALTER TABLE thread ADD whoviewed TEXT NOT NULL;
Create new phrase
already_viewed_this_thread / Already viewed this thread:
Edit template
Open SHOWTHREAD and find:
<!-- currently active users -->
<if condition="$show['activeusers']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="2">
<phrase 1="$totalonline" 2="$numberregistered" 3="$numberguest">$vbphrase[users_viewing_this_thread_x_y_z]</phrase>
</td>
</tr>
<tr>
<td class="alt1" colspan="2">
<span class="smallfont">$activeusers</span>
</td>
</tr>
</table>
</if>
<!-- currently active users -->
Below this add:
<!-- who viewed this thread -->
<br />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="2">
$vbphrase[already_viewed_this_thread]
</td>
</tr>
<tr>
<td class="alt1" colspan="2">
<span class="smallfont">$thread[viewers]</span>
</td>
</tr>
</table>
<!-- who viewed this thread -->
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:
$showinvisible = 1;
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:
https://vborg.vbsupport.ru/showthread.php?t=61225
Johannes de Le?n
06-30-2005, 09:58 PM
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:
https://vborg.vbsupport.ru/showthread.php?t=61225
I'll see what I can do. :)
Chris M
06-30-2005, 10:11 PM
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
07-01-2005, 11:09 AM
Excellent Johannes! I will install when I get home tonight ... :D
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:
<if condition="in_array($bbuserinfo['usergroupid'], array( 5, 6, 7))">
<!-- who viewed this thread code-->
</if>
...will restrict viewing only to admins and mods. Add other usergroups at your discretion.
Installed, and thanks. :up:
Marco van Herwaarden
08-12-2005, 10:35 AM
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.
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
08-12-2005, 11:54 AM
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
08-18-2005, 08:36 PM
just showing my appriciation for the hack, installed! thank you for making it.
poolking
08-19-2005, 04:57 AM
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:
Then quit dragging it up. Marco, thanks for clarifying.
mrsbuzzy
09-02-2005, 01:14 AM
Hi just wondering if there was any resolution as to a way to get the time viewed next to the name?
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
09-02-2005, 04:26 AM
Could you tell me whats the point in having the time next to the members name?
mrsbuzzy
09-02-2005, 11:08 AM
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
09-22-2005, 12:00 AM
any way to make it count the # who've viewd it ?
Bhuwan
09-25-2005, 12:52 PM
Could you please add the text markup for a user name??? pretty please
KidneyBoy
09-29-2005, 05:05 PM
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
10-02-2005, 07:01 PM
I'm having a problem with it on gold as well. Methinks it isn't compatible.
mrsbuzzy
10-02-2005, 07:19 PM
I'm using it on 3.5.0 Release Candidate 2 without any problems.
I'm having a problem with it on gold as well. Methinks it isn't compatible.
Works just fine for me.
KidneyBoy
10-02-2005, 07:59 PM
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)
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.
Markco
10-10-2005, 04:48 AM
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
10-11-2005, 07:11 AM
doesn't work for me on = vb 3.5 Gold
I've got blank page when click on showthread
GrendelKhan{TSU
10-11-2005, 07:21 AM
thanks!!
/me installs (vb 3.5.0 Gold)
microzott
10-12-2005, 06:21 AM
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
Yes, I agree, the date and time would be great to have.
Rocol
10-17-2005, 12:26 PM
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
10-18-2005, 01:54 PM
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):
array_push($viewers, "<a target=\"_blank\" href=\"member.php?".$vbulletin->session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
to this line:
array_push($viewers, "<a target=\"_blank\" href=\"member.php?".$vbulletin->session->vars['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
.. then it works again. :)
mrsbuzzy
10-18-2005, 02:47 PM
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):
array_push($viewers, "<a target=\"_blank\" href=\"member.php?".$vbulletin->session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
to this line:
array_push($viewers, "<a target=\"_blank\" href=\"member.php?".$vbulletin->session->vars['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
.. then it works again. :)
Mastar
10-19-2005, 02:56 AM
Like a charm and Clicked install!!
cmiller1014
10-23-2005, 01:57 AM
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
10-24-2005, 06:18 PM
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
11-18-2005, 04:58 PM
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
11-18-2005, 10:55 PM
no problems in vb3.5 gold
shama
11-19-2005, 03:20 AM
I will try this one and I hope it works with me :)
aranthorn
12-05-2005, 07:30 PM
Had to un-install, way too much load with 100+ users on line.
i have 300+ users online ....could this plugin cuz high load?
bryanb
12-14-2005, 11:33 AM
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
12-14-2005, 11:52 AM
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:
<if condition="in_array($bbuserinfo['usergroupid'], array( 5, 6, 7))">
<!-- who viewed this thread code-->
</if>
...will restrict viewing only to admins and mods. Add other usergroups at your discretion.
Installed, and thanks. :up:
bryanb
12-14-2005, 03:09 PM
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
12-16-2005, 05:34 AM
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
12-27-2005, 08:26 PM
If anybody can point me into the right direction, I'd really appreciate it. Thanks in advance!
vietkieu_cz
01-05-2006, 06:10 PM
I need this hack for only some Forum (some thread), not for all forums (not all threads), can I help me?
ForeverForums
01-10-2006, 06:06 PM
i got this working flawless in 3.5.2
*installs*
AraServ
01-21-2006, 11:24 PM
i can't make it work on 3.5.3 !!!
Silvio
01-23-2006, 03:15 PM
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
02-17-2006, 05:03 AM
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
03-05-2006, 01:59 PM
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
03-05-2006, 02:07 PM
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
03-05-2006, 11:38 PM
Just wanted to add: great job! I clicked *Install* and gave the thread a 5 Star rating :nervous:
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
07-30-2006, 06:15 PM
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:
<if condition="in_array($bbuserinfo['usergroupid'], array( 5, 6, 7))">
<!-- who viewed this thread code-->
</if>
...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
07-30-2006, 07:59 PM
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
11-02-2006, 03:01 AM
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
04-05-2007, 06:33 PM
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
07-11-2007, 09:19 PM
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
07-11-2007, 10:40 PM
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
07-30-2007, 12:16 AM
i need this mod but i cant run it on php5
plz quick help
ahmedeldeep
07-30-2007, 05:38 PM
plz help
HossMon
12-31-2008, 04:09 AM
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.
<!-- end currently active users -->
</if>
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...
<!-- end who viewed this thread -->
</if>
I hope that makes sense to everyone. It's late and I've been at it for a while!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.