PDA

View Full Version : Show Thread Enhancements - Who viewed this thread?


Gary King
02-05-2004, 10:00 PM
There is an enhanced version of this mod found here (https://vborg.vbsupport.ru/showthread.php?t=68876).

Who viewed this thread?
Version: 1.0
vB-version: 3.0.0 Release Candidate 3
Developer: Gary W
Install difficulty: Extremely Easy
File edits: 1
Template edits: 1

Description of the Hack:
This hack shows who has viewed any thread. View the screenshot to see how it looks.

If you don't want to have invisible users in the list, then remove $showinvisible = 1;

View the screenshot to see the hack in action :D

Instructions

FILES
------
showthread.php

TEMPLATES
-------------
SHOWTHREAD

RUN QUERY: ALTER TABLE thread ADD whoviewed TEXT NOT NULL;

ADD PHRASE:
already_viewed_this_thread / Already viewed this thread:


OPEN FILE showthread.php AND FIND


// ************************************************** *******************************
//set thread last view
set_bbarray_cookie('thread_lastview', $threadid, TIMENOW);


ABOVE ADD


$showinvisible = 1;

// Get who has already viewed this thread
$currentthread = $DB_site->query_first("SELECT whoviewed FROM ".TABLE_PREFIX."thread WHERE threadid = $threadid");
$vieweduserids = explode(" ", $currentthread['whoviewed']);

$userinfo = fetch_userinfo($bbuserinfo['userid']);

if (!$userinfo['invisible'] OR $showinvisible)
{
if (!empty($currentthread['whoviewed']))
{
if (!in_array($bbuserinfo['userid'], $vieweduserids))
{
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET whoviewed = CONCAT(whoviewed, \" \", \"" .$bbuserinfo['userid'] . "\") WHERE threadid = $threadid");
}
}
else
{
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET whoviewed = \"" . $bbuserinfo['userid'] . "\" WHERE threadid = $threadid");
}
}

// Who has viewed this thread?
if (empty($currentthread['whoviewed']))
{
$thread['viewers'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result = $DB_site->query("SELECT userid, username FROM ".TABLE_PREFIX."user WHERE userid IN (" . implode(", ", $vieweduserids) . ")");
$viewers = array();
while ($user = $DB_site->fetch_array($result))
{
array_push($viewers, "<a target=\"_blank\" href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewers'] = implode(", ", $viewers);
}



OPEN SHOWTHREAD TEMPLATE AND FIND

$poll

ABOVE ADD

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"><tbody>
<tr>
<td class="thead">
<a style="float:$stylevar[right]" href="#top" onClick="return toggle_collapse('forumhome_todayactiveusers')"><img id="collapseimg_forumhome_todayactiveusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_todayactiveusers].gif" alt="" border="0" /></a>
$vbphrase[already_viewed_this_thread]
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_todayactiveusers" style="$vbcollapse[collapseobj_forumhome_todayactiveusers]">
<tr>
<td class="alt1"><div class="smallfont">
$thread[viewers]
</div></td>
</tr>
</tbody>
</table>
<br />

INSTALLATION COMPLETE! :)

Omega Prime
02-06-2004, 12:32 PM
oooh! Thanks for making this hack so fast :D !

Xenon
02-06-2004, 01:10 PM
you should rename that php file into .txt ;)

mashour.net
02-06-2004, 01:20 PM
Thanks :rolleyes:

sabret00the
02-06-2004, 03:18 PM
not bad, not bad at all, would be great as a store action :)

Gary King
02-06-2004, 07:22 PM
you should rename that php file into .txt ;)
I did it real quick and my default file format is PHP :p
Fixing now :)

Gary King
02-06-2004, 07:23 PM
not bad, not bad at all, would be great as a store action :)
You mean for the Store hack?

sabret00the
02-06-2004, 08:26 PM
yup theirs no vb3 version yet, but it would be awesome, to buy the power to see who's viewed threads :)

WAR
02-08-2004, 01:14 AM
Is this Hack HTL compliant?

I noticed that the changes file was .htl but you didn't really indicate that it was anywhere else in this thread...

Gary King
02-08-2004, 01:56 AM
Is this Hack HTL compliant?

I noticed that the changes file was .htl but you didn't really indicate that it was anywhere else in this thread...
There hopefully a bit more clear ;)

StarBuG
02-08-2004, 08:07 AM
Hi

I have one question.
What about if a thread was viewed by let´s say 150 members do I see the whole list of 150 members above the thread then?

Wouldn´t it be better to have the who viewed as a link wich opens a popup list.

Greetings

Star

Gary King
02-08-2004, 01:05 PM
Hi

I have one question.
What about if a thread was viewed by let?s say 150 members do I see the whole list of 150 members above the thread then?

Wouldn?t it be better to have the who viewed as a link wich opens a popup list.

Greetings

Star
Well technically that's how WOL works as well, so this is like that. If there are lots of people, then yes it will show the whole list, but it's not like every thread will be like that (hopefully) :D If there are lots of people who want this feature added then I could do that.

rms10
02-11-2004, 03:45 PM
If there are lots of people who want this feature added then I could do that.

I would like this feature added :)

rms10
02-11-2004, 04:41 PM
BTW trying to use the htl file to install the hack on RC4 and get the following error:

No Phrases file found in Hack data or file system!
No groupname specified.

running the verbose test it showed this info:

This step would import a new set of phrases for the Hack

It would create this new column on the language table:
phrasegroup_

It would take the new phrases from this file:
./htlfiles/whoviewed_phrases

Xenon
02-11-2004, 06:36 PM
Well technically that's how WOL works as well, so this is like that. If there are lots of people, then yes it will show the whole list, but it's not like every thread will be like that (hopefully) :D If there are lots of people who want this feature added then I could do that.
may i suggest another method?

just put it into a collapsable table, that way it wouldn't fill up to much space if not wanted ;)

Gary King
02-11-2004, 07:42 PM
may i suggest another method?

just put it into a collapsable table, that way it wouldn't fill up to much space if not wanted ;)
Yeah I know that was my alternative.

Gary King
02-11-2004, 08:26 PM
Collapsable table added :)

Gary King
02-11-2004, 08:28 PM
Fancy screenshot added as well :p

Xenon
02-11-2004, 08:54 PM
*gg* nice screeny

Gary King
02-11-2004, 09:12 PM
*gg* nice screeny
Thanks :D

Alas-Digitales
02-12-2004, 09:49 PM
Is it possible to show this option also to super-moderatos? I have tried to insert it this way:

<if condition="$+++++ad and $bbuserinfo[usergroupid]==5 and $bbuserinfo[usergroupid]==6">

But it does no work. How can I do it?

Gary King
02-12-2004, 09:58 PM
Is it possible to show this option also to super-moderatos? I have tried to insert it this way:

<if condition="$+++++ad and $bbuserinfo[usergroupid]==5 and $bbuserinfo[usergroupid]==6">

But it does no work. How can I do it?
Use 'or' instead of 'and'.

Alas-Digitales
02-12-2004, 10:06 PM
Thanks!!!

Ocean
03-29-2004, 12:13 PM
Hi, Gary!


Quick question - is this hack fully stable and compatible with vB 3.0 Gold? Or does it need to be updated?

Gary King
03-29-2004, 07:04 PM
Hi, Gary!


Quick question - is this hack fully stable and compatible with vB 3.0 Gold? Or does it need to be updated?
Yes it should work with Gold.

Ocean
03-29-2004, 07:34 PM
Great!

Thanks again!

Carter876
03-30-2004, 09:38 AM
Hi Gery W, I like very much this hack but I have a questions:
Is there the possibility that onlyAdmins see this "Who viewed this thread" Panel (if Yes, How?)

Tnx and compliments for the nice hack :)

Regards

Ocean
03-30-2004, 12:07 PM
Hi, Gary! I just installed this hack, but I'm having three issues with it:


1. Invisible Users don't show up at all. I would have thought that this would work like vB's Currently Active Users, or even like your Who Was Online Today - where Invisible Users appear to those who have the rights to see them (and they are suffixed with a " * " character. But in this case, they are just not there.

2. The Title Bar doesn't actually reach all the way to the right side. If you collapse it, then it displays properly. But while expanded, it falls a quarter inch short.

3. On your Who Was Online Today hack, when you click on a Username, it brings up the profile in the same window. But on this one, it opens a new window. Is this easily fixable?


Now the only question is - did I do something wrong? Or are these three issues actually bugs? :)

Gary King
03-30-2004, 11:11 PM
Hi, Gary! I just installed this hack, but I'm having three issues with it:


1. Invisible Users don't show up at all. I would have thought that this would work like vB's Currently Active Users, or even like your Who Was Online Today - where Invisible Users appear to those who have the rights to see them (and they are suffixed with a " * " character. But in this case, they are just not there.

2. The Title Bar doesn't actually reach all the way to the right side. If you collapse it, then it displays properly. But while expanded, it falls a quarter inch short.

3. On your Who Was Online Today hack, when you click on a Username, it brings up the profile in the same window. But on this one, it opens a new window. Is this easily fixable?


Now the only question is - did I do something wrong? Or are these three issues actually bugs? :)
All 3 are fixed :) The invisible users part, it shows invisible users to all users to have less strain on the servers.

Ocean
03-30-2004, 11:28 PM
All 3 are fixed :) The invisible users part, it shows invisible users to all users to have less strain on the servers.


Great! I'll give it a shot tomorrow and see how it goes.


Incidentally, I only plan on certain users being able to access this feature - so I wouldn't think it would be that great a strain on the Server, for me at least.

What would I need to change, if I wanted Invisible Users handled the same way it is on the Forum Home? (i.e. Only shown to those with access to see Invisible Users, suffixed with the "*" character, etc...)

:)

Carter876
03-31-2004, 06:48 AM
Hi Gery W, I like very much this hack but I have a questions:
Is there the possibility that onlyAdmins see this "Who viewed this thread" Panel (if Yes, How?)

Tnx and compliments for the nice hack :)

Regards

Gery can you answer to my question, pls?

Tnx :)

Ocean
03-31-2004, 09:56 AM
Gery can you answer to my question, pls?

Tnx :)

Carter876, take the entire block of code that you are supposed to enter into the Showthread Template and surround it like this:



<if condition="is_member_of($bbuserinfo,6)">

<!-- Inserted code goes here -->

</if>




By doing that, you are saying that that code will apply only if the User is a member of Group-ID 6 (which should be the default for Admins).

VitroX
03-31-2004, 12:21 PM
This is a wonderfull hack, thanks for making.

I wonder if it is possible to show the members with color depending of the usergroup where they belongs, per example Admins in red, Mods in blue, etc.

Thanks again.

Carter876
03-31-2004, 08:40 PM
Carter876, take the entire block of code that you are supposed to enter into the Showthread Template and surround it like this:



<if condition="is_member_of($bbuserinfo,6)">

<!-- Inserted code goes here -->

</if>




By doing that, you are saying that that code will apply only if the User is a member of Group-ID 6 (which should be the default for Admins).




Tnx for the help but this code don't work (i have a Parse error) :disappointed:

Someone can help me, pls?

Regards

Ocean
04-01-2004, 07:32 PM
All 3 are fixed :) The invisible users part, it shows invisible users to all users to have less strain on the servers.

Hi, Gary! I finally got the chance to install the revised version. And although the problem with the Invisible Users and the Title Bar are fixed (thanks!), the third problem remains. Clicking on a Username still opens up the Profile in a new window, rather than the same one.


p.s. I'm still interested in knowing what I would need to change, if I wanted Invisible Users handled the same way it is on the Forum Home. (i.e. Only shown to those with access to see Invisible Users, suffixed with the "*" character, etc...) :) :) :)

Ocean
04-01-2004, 07:37 PM
Tnx for the help but this code don't work (i have a Parse error) :disappointed:

Someone can help me, pls?

Regards

Carter876, the code does the job perfectly. I just tried it myself. Are you sure you implemented it correctly?

The code needs to be inserted into the ShowThread **Template** (NOT Showthread.php). If you put it into ShowThread.php, that would account for the Parse Error.

But in the Template, the complete code to be inserted (including the Admin-Only section) is as follows:





<if condition="is_member_of($bbuserinfo,6)">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"><tbody>
<tr>
<td class="thead">
<a style="float:$stylevar[right]" href="#top" onClick="return toggle_collapse('forumhome_todayactiveusers')"><img id="collapseimg_forumhome_todayactiveusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_todayactiveusers].gif" alt="" border="0" /></a>
$vbphrase[already_viewed_this_thread]
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_todayactiveusers" style="$vbcollapse[collapseobj_forumhome_todayactiveusers]">
<tr>
<td class="alt1"><div class="smallfont">
$thread[viewers]
</div></td>
</tr>
</tbody>
</table>
<br />

</if>




Also, remember that although I stated that Group-ID 6 should be the default for Admins - that doesn't mean that it's not possible for that to have changed on your system. It's worth double checking both that, as well as the syntax.

Gary King
04-01-2004, 08:37 PM
Hi, Gary! I finally got the chance to install the revised version. And although the problem with the Invisible Users and the Title Bar are fixed (thanks!), the third problem remains. Clicking on a Username still opens up the Profile in a new window, rather than the same one.


p.s. I'm still interested in knowing what I would need to change, if I wanted Invisible Users handled the same way it is on the Forum Home. (i.e. Only shown to those with access to see Invisible Users, suffixed with the "*" character, etc...) :) :) :)
To open in same window, remove target="_blank"

Carter876
04-01-2004, 09:04 PM
Carter876, the code does the job perfectly. I just tried it myself. Are you sure you implemented it correctly?

The code needs to be inserted into the ShowThread **Template** (NOT Showthread.php). If you put it into ShowThread.php, that would account for the Parse Error.


Ops you are right ;) , it now works perfectly :up: Tnx :D

I have another question (maybe a little bug) and a suggestion:

1.) If I close the collapsable table of "Who viewed this thread" I see my Collapsable table of "Number of Active Users" in Index that is Closed too, why!?
2.) Is there the possibility to signal how many times a user has seen that threads?

Tnx for the help! :)

Regards

Isotope
04-02-2004, 12:04 AM
What needs to be changed in the code, if I want this bar to be Collapsed by default, rather than expanded?

pcalloway
04-03-2004, 11:07 PM
My table heading is showing as blank rather then stating:

"Already viewed this thread:"

In the phrase manager I used "already_viewed_this_thread" as the Var name and "Already viewed this thread:" as the text. Did I goof something up?

VitroX
04-06-2004, 12:36 PM
This is a wonderfull hack, thanks for making.

I wonder if it is possible to show the members with color depending of the usergroup where they belongs, per example Admins in red, Mods in blue, etc.

Thanks again.

This feature is not possible?

Nj?rd Eriksson
04-06-2004, 01:16 PM
Great hack, Gary. Thank you. :)

Gary King
04-06-2004, 06:56 PM
My table heading is showing as blank rather then stating:

"Already viewed this thread:"

In the phrase manager I used "already_viewed_this_thread" as the Var name and "Already viewed this thread:" as the text. Did I goof something up?
Did you modify the showthread template?

pcalloway
04-10-2004, 02:20 AM
Did you modify the showthread template?

Yeah, right above $poll... sure did.

Gary King
04-10-2004, 02:47 PM
Go to View Source and check to see if you can find: collapseobj_forumhome_todayactiveusers in it.

Ocean
04-15-2004, 03:33 PM
Hi, Gary! Quick question...

For this hack, you say to put the code ABOVE this text:


// ************************************************** ****************************** *
//set thread last view


By doing this, we are inserting your PHP code at the end of the "Update Views Counter" Section. However, in vB 3.0.1 - this section is no longer in the same place.

In vB 3.0.1, directly above the "Set Thread Last View" section, is a comment listed: "END LINEAR / THREADED"


So, the question is:

Should we still be inserting the code above the "Set Thread Last View" section? Or should we be putting at the END of the "Update Views Counter" Section?
:)

Gary King
04-15-2004, 09:51 PM
The lower the better, before the output of the postbit anyways.

So I say, put it lower if you can't put it exactly where it's supposed to be :)

Ocean
04-15-2004, 10:16 PM
The lower the better, before the output of the postbit anyways.

So I say, put it lower if you can't put it exactly where it's supposed to be :)

Aha! So, in other words - your original instructions stand.

Thanks, Gary. :)

knetgummi
04-19-2004, 08:22 PM
thats a reaaly good one
thank u very much
greetz
knetgummi

JagFan
04-19-2004, 09:05 PM
I installed! Works great...thanks!!

weaver
04-24-2004, 10:27 PM
2.) Is there the possibility to signal how many times a user has seen that threads?

I'm interested in this as well... or some way of telling when was the most recent time they viewed the thread.

welo
04-25-2004, 12:54 AM
Installed. Nice little hack. Took me a minute to find the first <tbody> tag (at the end of the line), and I added

<div style="float:left">Who viewed this thread:</div>
..right before

<a style="float:$stylevar[right]" href="#top" etc>
...to clarify a bit. Might also be prudent in the SHOWTHREAD template to wrap the whole thing with a quick "if" statement to restrict viewing only to admins:

<if condition="in_array($bbuserinfo['usergroupid'], array(5, 6, 7))">
[SHOWTHREAD code goes here]
</if>

Thanks. This will come in handy.

Gary King
04-25-2004, 12:57 AM
Well not everyone wants to only show this to staff :)

Also, you should use the following instead: <if condition="is_member_of($bbuserinfo, 5, 6, 7)">

welo
04-25-2004, 01:08 AM
Got it. Any idea how to add how many guests have viewed the thread? That would be pretty cool too.

Ah, wait, that wouldn't work anyway. I suppose some math could be coded to subtract the number of names in the list from the number of thread views, but that would give a distorted measurement unless you install this hack on a fresh board. Was a passing thought.

Thanks again.

welo
04-25-2004, 02:15 AM
Also, you should use the following instead: <if condition="is_member_of($bbuserinfo, 5, 6, 7)">
Sorry man, this code doesn't work. I was able to see it but no other usergroup could (probably because the rest of my staff are all in specially created usergroups, an dnot in the default list). My code works.

Gary King
04-25-2004, 01:36 PM
Well just replace the ID no. with yours.

welo
04-25-2004, 03:24 PM
That's what I did. In our case I had to use ($bbuserinfo, 6, 9, 10, 11, 17). In this case the only default usergroup is 6 (me). I could see it but nobody else on staff could (I didn't know this until someone mentioned it, so I logged in as then and confirmed). Once I switched it back to my code they could all see it fine.

Gary King
04-25-2004, 03:31 PM
Then probably has to be an array.

is_member_of($bbuserinfo, array(5, 6, 7)) just try that :) The reason you should use this code instead of yours, because it checks additional groups as well.

welo
04-25-2004, 04:13 PM
Sorry man. Using that code I can't even see it. Am also unclear what you mean by "...because it checks additional groups..." Checking them for what? All other groups are excluded.

Gary King
04-25-2004, 04:16 PM
Check the membergroupids, not just usergroupid

welo
04-25-2004, 05:10 PM
I apologize once again, because I have no idea what you just said.

Gary King
04-25-2004, 05:47 PM
the is_member_of function also checks the additional usergroups for users, not just their primary usergroup

welo
04-25-2004, 06:19 PM
Ah, I see what you mean. Kinda makes it too bad it doesn't work, huh? ;)

Gary King
04-25-2004, 06:30 PM
It should.

Gary King
04-25-2004, 06:31 PM
Check the function declaration to see that you are using it properly.

welo
04-25-2004, 07:01 PM
Ok, look - I've tried applying what you gave me exactly as you stated and it doesn't work. This is especially frustrating when I started out this whole thing by posting code that does work. Since it's clear you're feeding me suggestions you aren't bothering to test, I say we stop this conversation now. Give me something that you know works or quit wasting my time by increasing your post count with useless one-sentence replies.

I hate to sound harsh or frustrated, but damn. I'm only trying to help make your hack better. Peace, out.

Intex
05-22-2004, 07:44 AM
Nice Hack Gary W. /me clicks install.

DCX
05-28-2004, 04:37 AM
gettin this error when i try to view a thread.....

Database error in vBulletin 3.0.1:

Invalid SQL: SELECT whoviewed FROM thread WHERE threadid = 6505
mysql error: Unknown column 'whoviewed' in 'field list'

mysql error number: 1054

Date: Friday 28th of May 2004 05:35:42 AM
Script: xxx
Referer: xxx
Username: xxx
IP Address: xxx

mtha
05-28-2004, 08:02 AM
if (!$userinfo['invisible'] OR $showinvisible)
{
if (!empty($currentthread['whoviewed']))
{
if (!in_array($bbuserinfo['userid'], $vieweduserids))
{
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET whoviewed = CONCAT(whoviewed, \" \", \"" .$bbuserinfo['userid'] . "\") WHERE threadid = $threadid");
}
}
else
{
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET whoviewed = \"" . $bbuserinfo['userid'] . "\" WHERE threadid = $threadid");
}
}

It seems like this code will record "guest id = 0" too.
Should it check if $bbuserinfo['userid'] exist?

Nj?rd Eriksson
05-29-2004, 05:32 PM
Great! I'll give it a shot tomorrow and see how it goes.


Incidentally, I only plan on certain users being able to access this feature - so I wouldn't think it would be that great a strain on the Server, for me at least.

What would I need to change, if I wanted Invisible Users handled the same way it is on the Forum Home? (i.e. Only shown to those with access to see Invisible Users, suffixed with the "*" character, etc...)

:)
Gary,

What would I have to change if I would like that members with a certain user ID or members of a certain usergroup are NOT displayed on the "Who viewed this thread?" list, even if they have viewed a certain thread?

I don't want myself listed for others.

weaver
05-29-2004, 05:54 PM
I'm interested in this as well... or some way of telling when was the most recent time they viewed the thread.
I'm still interested in this if anyone has figured out how to do it. I'd like to be able to pinpoint if a member has read a post after additional information was posted for them. Right now I can only determine if they read the post at all. Thanks. :)

Ocean
06-02-2004, 01:53 PM
I have a really great idea for a way to improve this hack.


The basis is this - it's nice to be able to see who has viewed a particular Thread. But once that Thread gets going - it becomes next to useless if you need to ask "Okay, who has viewed this Thread since Post #13 was made?"


I would recommend, for Admins only, that the functionality be added so that they can see who last viewed a given thread since a particular date and time.


This can be done in a number of ways with varying levels of functionality:




Method 1


Underneath the current "Already viewed this thread" section, a second section would be added - "Viewed this Thread since..."

This section will be updated just like the first one. However, this section will have a Reset button. When an Admin clicks on the Reset button - it clears all users from that section. The section will list the new Date/Timestamp - and will start collecting User View information from that point on.

So that it will now show, for example, "Users who have viewed this Thread since 6/2/2004 10:31pm:"

Effectively, it works like your car's Trip Odometer.


This method would (I think) only require an additional field in the database for a second set of User View data. It would get updated just like the first one - it's just that there is a Reset button in each ShowThread page that allows Admins to clear this second set of data and set a new Date/Timestamp to be shown.

I would think that this first method should be very easy to implement. But Gary would have to chime in here to confirm. :)



Method 2


Add the ability for this hack to store Date/Timestamps for each user who views any given thread. It only needs to store the Last Viewed date/time.

Then, add a second section (similar to example 1) - however, this one has an Input Box that allows you to type a date (and possibly a time) in. Then, you can refresh the page and that second section will show all users who have Viewed that Thread since the date/time you entered.


As a secondary benefit/implementation - since under this method, the date/time of Last Viewed will be stored for each user, it should be easy to make it so that by hovering your mouse over a username in the first section (the "Already viewed this thread" section), you can get a tooltip with the date and time that that user last viewed this thread.


The advantage of this method over Method #1, is that you can check for Last Viewed data retroactively.

The disadvantage, of course, is the complication of implementing this. And perhaps, a performance concern.




So, what do you guys think? Would this be useful to you? :)


Gary, do you like this idea? Is either Method practically doable?

Intex
06-02-2004, 01:57 PM
I'd personnally find that very useful. I have a thread where I update the progress of certains items on the website. At the moment I have to delete the thread and re-create it, if I want to see who's viewed it again, since I last made any updates.

Option 1 is probably more work than option 2. The timestamp from my perspective would be the one to go for. It would be great if someone could implement this change.

Ocean
06-02-2004, 02:26 PM
I'd personnally find that very useful. I have a thread where I update the progress of certains items on the website. At the moment I have to delete the thread and re-create it, if I want to see who's viewed it again, since I last made any updates.

Option 1 is probably more work than option 2. The timestamp from my perspective would be the one to go for. It would be great if someone could implement this change.

The original version of this hack only adds one Field ("whoviewed") to the "threads" table. It stores a list of UserIDs, and that's it.

Method 1 would only add another Field (i.e. "whoviewedsince" ), which would be handled in exactly the same manner.


If we go with Method 2, some way needs to be found to efficiently store a date/timestamp with each UserID for each thread. To my mind, that makes Method 2 more complicated to implement - although I agree that it would be the more useful option. :)

FWF
07-01-2004, 06:08 AM
this should be updated for 3.0.1

FWF
07-05-2004, 03:06 AM
no update i take it ?

Rocol
07-06-2004, 05:27 PM
Will this hack be udated to work on vB3.0.3 please ... thanks in advance guys, keep up the excellent work ;)

Ocean
07-06-2004, 07:21 PM
Will this hack be udated to work on vB3.0.3 please ... thanks in advance guys, keep up the excellent work ;)



I have this working on a 3.0.3 installation. Is there a reason why you think that it needs to be updated for 3.0.3?

mtha
07-06-2004, 08:36 PM
I have this working on a 3.0.3 installation. Is there a reason why you think that it needs to be updated for 3.0.3?
:) because the hack said to work with version 3.0.0, and some people dont want to give it a shoot in other versions.

update would be adding a line, saying it works with ... some versions :D

Rocol
07-07-2004, 07:24 AM
@ Ocean .. thanks for the reply, after reading that it worked for you, I checked again .. it was my bad application of the hack .. when copying I had missed off the last } .. all working fine now .. thanks ;)

Ocean
07-07-2004, 10:10 AM
@ Ocean .. thanks for the reply, after reading that it worked for you, I checked again .. it was my bad application of the hack .. when copying I had missed off the last } .. all working fine now .. thanks ;)


:)

I'm glad everything's working well. :)

FWF
07-13-2004, 02:58 AM
I was told this didnt work corectly for 3.0.1 ?

xmitchx
07-17-2004, 06:29 AM
It works for all 3.0.x so far (tested). :)

gotvenm
07-19-2004, 11:27 PM
i guess im just stoopid cause i cant get this mod to work without a parse error.

what exactly is mod'd in the showthread.php ?

I dont understand this statement in the instructions

OPEN FILE showthread.php AND FIND
// ************************************************** ****************************** *
//set thread last view
set_bbarray_cookie('thread_lastview', $threadid, TIMENOW);




ABOVE ADD
---------

<if condition="is_member_of($bbuserinfo,6)">

$showinvisible = 1;

// Get who has already viewed this thread
$currentthread = $DB_site->query_first("SELECT whoviewed FROM ".TABLE_PREFIX."thread WHERE threadid = $threadid");
$vieweduserids = explode(" ", $currentthread['whoviewed']);

$userinfo = fetch_userinfo($bbuserinfo['userid']);

if (!$userinfo['invisible'] OR $showinvisible)
{
if (!empty($currentthread['whoviewed']))
{
if (!in_array($bbuserinfo['userid'], $vieweduserids))
{
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET whoviewed = CONCAT(whoviewed, \" \", \"" .$bbuserinfo['userid'] . "\") WHERE threadid = $threadid");
}
}
else
{
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET whoviewed = \"" . $bbuserinfo['userid'] . "\" WHERE threadid = $threadid");
}
}

// Who has viewed this thread?
if (empty($currentthread['whoviewed']))
{
$thread['viewers'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result = $DB_site->query("SELECT userid, username FROM ".TABLE_PREFIX."user WHERE userid IN (" . implode(", ", $vieweduserids) . ")");
$viewers = array();
while ($user = $DB_site->fetch_array($result))
{
array_push($viewers, "<a target=\"_blank\" href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewers'] = implode(", ", $viewers);
}
</if>


i put this in the showthread template above $poll


<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"><tbody>
<tr>
<td class="thead">
<a style="float:$stylevar[right]" href="#top" onClick="return toggle_collapse('forumhome_todayactiveusers')"><img id="collapseimg_forumhome_todayactiveusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_todayactiveusers].gif" alt="" border="0" /></a>
$vbphrase[already_viewed_this_thread]
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_todayactiveusers" style="$vbcollapse[collapseobj_forumhome_todayactiveusers]">
<tr>
<td class="alt1"><div class="smallfont">
$thread[viewers]
</div></td>
</tr>
</tbody>
</table>
<br />


thanks...

gotvenm
07-22-2004, 08:12 PM
anyone using this mod ?

help ? please ?

flame
08-24-2004, 09:16 PM
the reason your getting a parse error is because you have this (<if condition="is_member_of($bbuserinfo,6)">) in your .php file whereas it should be in your showthread template.

Also a small requesy ont knoe if its posible, but what aout changing the font colour for ppl wo have replied to thread theat way we can see quicly who has replied and who hasnt.

I had a look at whosposted, and the only way i can think of is to "compare" $posters against $viewers any matchs result in font change? is there such a function to compare to exlpoded lists?

Flame

Loki12
08-26-2004, 10:51 PM
ADD PHRASE:
already_viewed_this_thread / Already viewed this thread:



Where does one add this phrase??? :ermm:

Ocean
08-30-2004, 07:41 PM
Hi, everyone!


A while back, I posted some suggestions for improving this already excellent hack. As some time had passed, I decided to make some of those modifications myself and offer them as an enhanced version of this hack.

I have just released it earlier today. For anyone who's interested, Gary has put a link to it from the first post of this thread.


Or, here it is again: https://vborg.vbsupport.ru/showthread.php?t=68876


:)

Edric
09-13-2004, 10:42 AM
I installed this about 12 hours ago on 3.0.1 but I do not get the list of Members that viewed threads (and Members did view threads for sure), the box is there for each thread but no Members are listed, any idea what am I doing wrong?

Bison
12-23-2004, 03:50 PM
bump ...

Tipi
01-17-2005, 11:03 PM
Installed!

Just wondering, but i got two lines with names on. The same names! It's just like i've installed the hack twice. Strange, but true. :nervous: Any idea why?

snake-boy
04-16-2005, 05:05 PM
I just installed 3.0.7 and decided to switch from this hack to the enhanced version by Ocean. Sadly (just like this thread), support seems to have been abandoned.

It does work though..

-snake

lewisbeech
08-15-2005, 08:36 AM
great hack! thanks a lot!

thunder_sti
09-11-2006, 08:52 AM
Would this work on vbulletin v3.5.5????

Thanks