View Full Version : Who Viewed This Thread - Enhanced Version
Ocean
08-29-2004, 10:00 PM
Who Viewed This Thread - Enhanced Version v1.3.2
Version: 1.3.2
vB Version: 3.0.3
Developer: Ocean
Install Difficulty: Moderately Easy
The original hack this references was done by Gary King (https://vborg.vbsupport.ru/showthread.php?t=61222). I modified his hack in order to gain some additional functionality.
This hack is meant to be installed instead of Gary's original version - not in addition to it (for sanity's sake, as far as managing the code is concerned).
(This was submitted as a seperate hack with Gary's permission. If this belongs in a different group, I'm sure a Moderator will move it accordingly. :) )
Description:
This hack will allow you to see which users have viewed any given Thread. In addition, there is a second section that is resettable. What this means, is that there are two sections that show a list of users who have viewed the Thread in question.
The first section is a Master List - it shows all users who have viewed that thread at ANY point in time (since the hack was installed).
The second section works like your car's Trip Meter. You can Reset that second section at any time and it will then show only the users that have viewed that thread FROM THAT POINT ON. In addition, this second section will show you the Date/Time of the last Reset, so that you know from what point that second list is showing. This is useful, for example, if you want to be able to see which users have viewed a thread after you have updated it, or after a particular post of interest has been made.
You can choose which UserGroups can view the Who Viewed information, or even if you want all users to be able to see the first section - but only certain UserGroups to see the second.
You can also choose whether you want the Who Viewed information to be displayed directly on the ShowThread page, or if you would prefer to only show a link that opens a Pop Up Window with the Who Viewed information there.
Release Notes:
v1.3.2
Fixed the problem where the Pop-Up Link was visible to users who didn't have permission to view that information. (They still wouldn't be shown the information - but the link shouldn't have been visible to them in the first place)
v1.3.1
Minor modifications to the Aesthetics of the ShowThread page, as well as the Who Viewed Pop Up Window. No functional changes. If you are using v1.3.0, you do not need to upgrade, unless you wish to have the new aesthetics.
v1.3.0
Added the ability to choose whether you want the Who Viewed information to be displayed directly on the ShowThread page (as it was for all prior versions of this hack), or if you would prefer to only show a link that opens a Pop Up Window with the Who Viewed information there. Also consolidated and cleaned up the code.
v1.2.6
Fixed the problem with the "Who Viewed Since" table collapsing the wrong object
v1.2.5
Minor changes to optimize code. No functional changes. If you have v1.2.4, you do not need to upgrade to v1.2.5.
v1.2.4
Reworked the Security Sections so that they are exponentially easier to set. Now, other than choosing which UserGroups you want to have access to this hack, you only need to change ONE variable in order to choose which Security Layout you want to use. :)
v1.2.3
Updated all of the Security Sections to allow for more flexibility in selecting which UserGroups may view the WhoViewed Information.
v1.2.1
Upgrade Notes have been updated, and an Upgrade Script provided for those who have Gary's original version installed. If you have already successfully installed v1.2 of this hack, there is no need to do anything further.
v1.2
The original hack allowed you to see which users had viewed any particular thread on your board. It was and is an excellent hack - however, I desired some additional functionality, and so I made the following changes:
1. The format of stored User IDs has changed to a comma delineated format. This was done to optimize the code by stripping out the need for an additional explode() and implode().
2. An additional set of information is now being kept and maintained. However, unlike the first set (which will show you who has viewed a particular thread - ever), the second set is resettable at any time by Admins. This gives you a "tripmeter" of sorts, as you can now tell who has viewed a particular thread from the last time you reset that counter for that thread.
3. The date and time of the last reset for each thread is kept and displayed. Otherwise, it would be self-defeating, as you wouldn't remember when you last reset it. :)
4. This hack has been written so that all functions are for Admins only. Instructions are included for modifying this, if you wish. (Note: Even if you make ALL information viewable to ALL users, only Admins are allowed to Reset Counters. It is recommended that you do not change this)
5. I have the template additions being added at the bottom of the ShowThread page (right above the posting permissions). It seems to make more sense putting it there, as it doesn't get in the way, aesthetically speaking. Basically, if you want to check that section, it's there - if not, you'll never be bothered by it. If you prefer to have it somewhere else, feel free to insert the ShowThread Template portion of the code wherever you wish.
UPGRADE NOTES:
The instructions for this hack assume that you do NOT have any prior version installed.
At the moment, if you already have Gary's original 1.0 version installed, you will either need to completely clear out the existing data, before installing this hack - or you can download the "WhoViewedUpgradeFormat.php" script in order to convert the data format over to the new style.
Instructions are included for upgrading.
Wow, looks nice, thanks for sharing ;)
Ocean
08-30-2004, 08:44 PM
Wow, looks nice, thanks for sharing ;)
You're welcome. And I'm glad you like it. :)
One more question... does this hack/mod adds any queries to a board?
Ocean
08-30-2004, 09:08 PM
One more question... does this hack/mod adds any queries to a board?
Yes, this one does. More so because of the added functionality.
Speaking for v1.2 of this hack - if you install it as is, meaning as a tool for Admins only, than it will add 2 Queries for regular users and 4 Queries for Admins - but only on the ShowThread page.
Also, the first time a user visits a thread, there will be one additional Query (the one that adds them to the database).
So, if, for example, your board has 8 Queries per page for the ShowThread page - after installing this hack in it's default format...
...regular users will see 11 Queries the very first time they view any given thread - but only 10 Queries for each subsequent visit.
...Admins will see 13 Queries the first time they view any given thread - but only 12 Queries for each subsequent visit.
It doesn't add nearly as much as, say, a Portal hack. But I do still wish I could trim it down further. If anyone has any suggestions, I'd be happy to consider it - but at the moment, this is what's necessary to get this functionality. :)
Phalynx
08-31-2004, 06:32 AM
Great, thanks for sharing!
Ocean
08-31-2004, 10:52 AM
Great, thanks for sharing!
You're welcome!
I hope you like it. :)
nando415
08-31-2004, 08:13 PM
is there anyway to make this only apply to certain forum sections?
Ocean
09-01-2004, 12:15 AM
is there anyway to make this only apply to certain forum sections?
What do you mean by forum sections? Do you mean that you want this to only apply to certain Subs? That you don't want it to function at all in any other sub? Or just that you don't want the fields to be displayed?
Give me some more details, and I'll be able to help you better. :)
Gary King
09-01-2004, 12:47 AM
What do you mean by forum sections? Do you mean that you want this to only apply to certain Subs? That you don't want it to function at all in any other sub? Or just that you don't want the fields to be displayed?
Give me some more details, and I'll be able to help you better. :)
He only wants it to function in certain forums.
nando415
09-01-2004, 02:20 PM
yeah...I only want it to show up in certain subforums, more then 1....anyway to do that?
Ocean
09-01-2004, 06:23 PM
yeah...I only want it to show up in certain subforums, more then 1....anyway to do that?
Absolutely. I should be able to post the code later today or tomorrow. :)
Ocean
09-02-2004, 12:09 PM
Okay, if you want this hack to only work for certain Forums/Subboards, than there are two steps you need to perform:
Step 1
In the ShowThread.php file, you are supposed to insert a section of code (from the hack instructions). What you need to do is to add the following code first (in the spot indicated by the hack instructions). Then, follow the instructions given in the commented section of the following code. Finally, add the section of code from the hack instructions where indicated below.
/*
In the following section of code, insert the Forum IDs of the forums that you want this hack to work for. Each Forum ID needs to be surrounded by single-quotes ( ' ), and all but the last one needs to have a comma after each entry. In the following code, Forums 6 and 7 have been specified. Change this to suit your needs.
*/
$whoviewed_selective_forums = array(
'6',
'7'
);
if (in_array($foruminfo['forumid'], $whoviewed_selective_forums))
{
$show_whoviewed = true;
// Insert code from hack instructions right below this line
}
else
{
$show_whoviewed = false;
}
Step 2
In the ShowThread Template, you are also supposed to insert a section of code (from the hack instructions). What you need to do is to add the following code first (in the spot indicated by the hack instructions). Then, add the section of code from the hack instructions where indicated below.
<if condition="$show_whoviewed">
<!-- Insert Code from hack instructions right below this line -->
</if>
And that should do it!
I get this error when trying to Reset Counter
" Could not find phrase 'redirect'. "
Ocean
09-02-2004, 03:49 PM
I get this error when trying to Reset Counter
" Could not find phrase 'redirect'. "
I would double check the code you pasted into the Misc.php file. That code references the phrase "redirecting", not "redirect" - so it might be that the code didn't get inserted properly.
Ocean
09-03-2004, 12:28 PM
I have just released v1.2.1 of this hack.
Anyone who has successfully installed v1.2, doesn't need to do anything. The changes were all related to upgrading from Gary's original version.
I released an upgrade script that would convert the data from the old format to the new - so anyone who hasn't installed this yet because you don't want to lose your current WhoViwed data, can now do so with no worries. :)
Upgrade instructions are included in the Instructions file.
can you plz be so kind and change the way it shows the stats ?!
I mean the load-time is much higher if 1000+ members viewed a thread..
a much better way would be doing it via POP-UP...
When u view a Forum you can see the Views and replies of the Topic... The Number of Replies leads to a POP-UP where u have short and clear listed who viewed the topic...
(its and integrated vb-feature)... but the number of views isnt hotlinked..
so why not hotlink it too and make it redirect to a pop up which dispalys the content of ya hack..!!
I hope u got what i mean and would be very cool if u release it..!!
Much eazier to handle then..!!
Thhnx and respect ;)
Ocean
09-06-2004, 02:07 PM
can you plz be so kind and change the way it shows the stats ?!
I mean the load-time is much higher if 1000+ members viewed a thread..
a much better way would be doing it via POP-UP...
When u view a Forum you can see the Views and replies of the Topic... The Number of Replies leads to a POP-UP where u have short and clear listed who viewed the topic...
Actually, that link leads to a list of who has posted in that thread, not who has viewed it. :)
(its and integrated vb-feature)... but the number of views isnt hotlinked..
so why not hotlink it too and make it redirect to a pop up which dispalys the content of ya hack..!!
I hope u got what i mean and would be very cool if u release it..!!
Much eazier to handle then..!!
Thhnx and respect ;)
Doing that would actually make things much less efficient, in so far as Admin actions are concerned. Usually, you need to know who viewed a thread once you're in it. To have to back out and click a link is a bit counterproductive.
Now, what I might do for a future version is offer an option whereby there will be a link within the thread that you could click in order to bring up the popup. If I did that, I might also add the View number hyperlink in addition.
I'll consider it for a future version. :)
Sinbad2uk
09-08-2004, 07:56 AM
Sorry for being a bit of a dummy, but how and where do I run these queries
1. Run the following SQL Queries (Adjust accordingly, if you use Table Prefixes):
**********
ALTER TABLE thread ADD whoviewed TEXT NOT NULL;
ALTER TABLE thread ADD whoviewedcounter TEXT NOT NULL;
ALTER TABLE thread ADD whoviewedreset INT(10) UNSIGNED NOT NULL;
I am very new to this and do not really understand what this means
Ocean
09-08-2004, 10:30 AM
Sorry for being a bit of a dummy, but how and where do I run these queries
1. Run the following SQL Queries (Adjust accordingly, if you use Table Prefixes):
**********
ALTER TABLE thread ADD whoviewed TEXT NOT NULL;
ALTER TABLE thread ADD whoviewedcounter TEXT NOT NULL;
ALTER TABLE thread ADD whoviewedreset INT(10) UNSIGNED NOT NULL;
I am very new to this and do not really understand what this means
SQL Queries can be run from Admin CP/Import & Maintenance/Execute SQL Query.
However, in order to run SQL Queries, your Config.php file has to have been configured to allow your User ID to run them - since SQL Queries can cause a lot of damage if not used properly. :)
Edric
09-12-2004, 06:31 PM
Does this hack work with VB 3.0.1?
Ocean
09-13-2004, 02:09 AM
Does this hack work with VB 3.0.1?
It should work fine with 3.0.1 - however the instructions were written for 3.0.3 - so you might find that some of the code you have to look for is slightly different. That aside, however, the code you have to insert should work fine as is. :)
nando415
09-13-2004, 06:57 PM
Ocean big thanks for your help! Is there anyway to make it so the "Already viewed this thread" "Already viewed this thread since" tables do not show up at all in forums i didnt specify them in? I know it doesnt show the names of people but Id prefer for it not to show at all
thanks!
Ocean
09-13-2004, 07:10 PM
Ocean big thanks for your help! Is there anyway to make it so the "Already viewed this thread" "Already viewed this thread since" tables do not show up at all in forums i didnt specify them in? I know it doesnt show the names of people but Id prefer for it not to show at all
thanks!
If you followed my instructions properly, you shouldn't see them at all in the Subs you chose to exclude.
That's what the new addition to the ShowThread template is for. :)
nando415
09-16-2004, 06:46 PM
If you followed my instructions properly, you shouldn't see them at all in the Subs you chose to exclude.
That's what the new addition to the ShowThread template is for. :)
ha....sorry, I dont know how I overlooked the template change. it works fine, thanks :nervous:
Ocean
09-16-2004, 08:50 PM
ha....sorry, I dont know how I overlooked the template change. it works fine, thanks :nervous:
You're welcome. I'm glad everything worked out. :)
robert_2004
09-29-2004, 02:19 PM
hey mate,
i reckon the popup would be much better to hold the info - otherwise my server will die.
if :
Currently Active Users Viewing This Thread: 1 (1 members and 0 guests) [put your link here]
and make it say "people who have already viewed this thread."
that would be fantastic.
Take care mate.
rjordan
10-02-2004, 04:56 PM
I kinda like the pop-up idea as you only pull the information when you want it.
A question: Does this show you when the user first (or last) read the message? I think it would be great if the master (original) "read" list included when the user first read the message and the secondary (trip-metered) "read" list included the last time someone read the message.
I belienve that if the above were in this hack, I would install it in a heartbeat! On Ikonboard, this was a great add-on. I would love to be able to add it on my vB board!
Ocean
10-02-2004, 05:41 PM
I kinda like the pop-up idea as you only pull the information when you want it.
A question: Does this show you when the user first (or last) read the message? I think it would be great if the master (original) "read" list included when the user first read the message and the secondary (trip-metered) "read" list included the last time someone read the message.
I belienve that if the above were in this hack, I would install it in a heartbeat! On Ikonboard, this was a great add-on. I would love to be able to add it on my vB board!
The Pop-Up window is something that I will probably add to the next version of this hack.
As to your question, unfortunately it does not show when a post has been read. But that is also why I added the second resetable counter. This way, you can add a post, for example, and reset the second counter so that you can see who has viewed that thread from that point on. This allows you to easily see who has viewed that thread at all, and who has viewed it after that particular change has been made.
Adding a date/time stamp would mean an additional Query for every thread view on your board. I'm not sure it would be worth the overhead - especially on larger boards.
rjordan
10-02-2004, 05:51 PM
Perhaps, then, instead of storing a bit that indicates that it has been viewed (assuming that is how you are doing it), you store the time and date value and check for a nul entry in the event that is has not been viewed? Doing this should not increase the queries as you are just querying for different data.
The value I have seen in this is when an announcement is made in the forums for whatever reason, people have stated that they never read the message. If there was a time limit on response to a message, if they had read the message, the time stamp would indicate that they saw it in the time allowed and had the chance to respond.
In any case, it is a great hack. This is just that extra function that I would not mind seeing.
The Pop-Up window is something that I will probably add to the next version of this hack.
that'd be nice
As to your question, unfortunately it does not show when a post has been read. But that is also why I added the second resetable counter. This way, you can add a post, for example, and reset the second counter so that you can see who has viewed that thread from that point on. This allows you to easily see who has viewed that thread at all, and who has viewed it after that particular change has been made.
:) then you can record IDs of those who has view thread in successive order. so it can be show as who viewed last with be displayed last (or first).
This include when you view the thread AGAIN, the script will check if your ID is already in the list, if it is, then your ID is moved to the end (or beginning) of the list. It might help knowing the sequence of reading (but losing the order of first reading)
Adding a date/time stamp would mean an additional Query for every thread view on your board. I'm not sure it would be worth the overhead - especially on larger boards.
The information is important, but another query wouldnt be good.
Ocean
10-02-2004, 06:25 PM
Perhaps, then, instead of storing a bit that indicates that it has been viewed (assuming that is how you are doing it), you store the time and date value and check for a nul entry in the event that is has not been viewed? Doing this should not increase the queries as you are just querying for different data.
Unfortunately, it's more than that. Right now, when a thread is viewed, the code will query the DB and check to see if that person's UserID is present in the list of users who have viewed that thread.
If it's present, than it leaves things be. If not, then it takes an additional query to add that UserID.
If we wanted to keep track of the date/time that each user last viewed each thread - than every thread view would need to look for and then add or edit the current date/time stamp.
Plus, since the user and date/time stamp would be stored together - and all users + date/time stamps are stored in a single field per thread, the added parsing adds no small amount of processing that needs to be done. Or rather, it's a small addition by itself - but not cumulatively when 5,000 users are all viewing threads simultaneously. :)
I'm not sure it's worth the processing time/power for any boards except small ones. However, I might add it in a future version, nevertheless. :)
The value I have seen in this is when an announcement is made in the forums for whatever reason, people have stated that they never read the message. If there was a time limit on response to a message, if they had read the message, the time stamp would indicate that they saw it in the time allowed and had the chance to respond.
In any case, it is a great hack. This is just that extra function that I would not mind seeing.
Actually, you can accomplish that function right now. In fact, it's easy when it's a new and single announcement - because all you have to do is save the user list once the time is up, and you'll know who viewed it by that point and who didn't.
Where it gets tricky, is if you edit or add to that announcement - because then the question is who read it since it was updated. It's for that reason that I added that second counter. Now, once you edit or add to an Announcement/Bulletin/Post, just reset the second counter for that thread. Now you'll know exactly who read it before your changes and who read it afterwards. :)
Ocean
10-02-2004, 06:28 PM
:) then you can record IDs of those who has view thread in successive order. so it can be show as who viewed last with be displayed last (or first).
This include when you view the thread AGAIN, the script will check if your ID is already in the list, if it is, then your ID is moved to the end (or beginning) of the list. It might help knowing the sequence of reading (but losing the order of first reading)
That would also add an additional query to every thread view. In addition, it's usefulness - in my opinion - is somewhat limited. Not to mention the fact that it would confuse a lot of people. :)
If we were going to go that route, we might as well add the full date/time stamp. (Which still may happen)
:)
Awesome!! *Clicks install!
bnn121
10-09-2004, 12:51 PM
I'm sorta confused...I do not have Garys hack installed...I would like ot install this enhanced version.
The instructions seem to be geared towards upgrades from previous versions.
Do you have a step by step to install this version?
Thanks
Ocean
10-09-2004, 01:01 PM
I'm sorta confused...I do not have Garys hack installed...I would like ot install this enhanced version.
The instructions seem to be geared towards upgrades from previous versions.
Do you have a step by step to install this version?
Thanks
bnn121, the instructions you are referring to are the upgrade instructions given in subsequent posts.
If you want the full instructions - you need to download the TXT file from the very first post in this thread - the same as you would do for any other hack on this site. :)
bnn121
10-09-2004, 01:12 PM
Okay...I have downloaded the txt file from first post. Please dont hurt me...LOL...I'm just trying to figure out this hack and how to install it...it refers to some php files which are not located in either of the two files you have in the first post of this thread.
Where exactly does the fresh install portion start?
I see release notes section, then a UPGRADE NOTES section.
>Choice One or Choice Two
After that is shows
File Modifications:
showthread.php
misc.php
Template Modifications:
ShowThread
New Phrases:
already_viewed_this_thread
already_viewed_this_thread_since
Number of SQL Queries: 3
After that I see nothing to indicate...begin here for a fresh or new install
Is this the begining of the install process? I do not have those files listed above...the showthread.php or misc.php
********************************
1. Run the following SQL Queries (Adjust accordingly, if you use Table Prefixes):
**********
ALTER TABLE thread ADD whoviewed TEXT NOT NULL;
ALTER TABLE thread ADD whoviewedcounter TEXT NOT NULL;
ALTER TABLE thread ADD whoviewedreset INT(10) UNSIGNED NOT NULL;
Ocean
10-09-2004, 01:57 PM
Okay...I have downloaded the txt file from first post. Please dont hurt me...LOL...I'm just trying to figure out this hack and how to install it...it refers to some php files which are not located in either of the two files you have in the first post of this thread.
Where exactly does the fresh install portion start?
I see release notes section, then a UPGRADE NOTES section.
>Choice One or Choice Two
After that is shows
File Modifications:
showthread.php
misc.php
Template Modifications:
ShowThread
New Phrases:
already_viewed_this_thread
already_viewed_this_thread_since
Number of SQL Queries: 3
After that I see nothing to indicate...begin here for a fresh or new install
Is this the begining of the install process? I do not have those files listed above...the showthread.php or misc.php
The Upgrade Notes section tells you what you need to do in order to modify the Full Install instructions - which start at Step 1.
As for the PHP files listed - the reason they are listed as files which need to be modified is because they are your files that need to be modified.
Those two PHP files in question are supposed to be in the root of your vB folder, not supplied by me. After all, if I supplied them - why would you need to further modify them? :)
bnn121
10-09-2004, 02:13 PM
LOL...I just relized those two files are in the root of VB...hmm...I've been looking over the instructions...and theres some files I cant find...eith in the showthread.php or even in any other folder?
5. Open the "SHOWTHREAD" template and Find
I'm unsure of where this is within VB
I did a search of the entire VB folder and within showthread.php and coame up with no such file or phrase.
Is it obviouls I have never done tis before...HEHE...guess you got to start somewhere...why not your hack...which I like, just wish I could figure this out
robert_2004
10-09-2004, 02:36 PM
okay, go into your vb Admin section.
open 'Styles & Templates' from the left menu.
choose 'Style Manager'
press the [ << >> ] button on the right hand side. that will show you all the templates that are used on the site.
(i.e. the file forum.php [for instance] only holds all the coding for that particular page. all the looks and style of the page will be kept in the template system under a similar name )
Okay, now it's showing templates - but only the custom-added ones. press the, now standard font << >> link, and it will open up every single group.
[ctrl] + [f] and type in 'showthread' then just click 'edit' or 'customise' next to the template, select all and copy and paste into dreamweaver to get better search and replace capabilites.
hope that helps.
bnn121
10-09-2004, 11:31 PM
Thanks...I'm working on this mod now...hoping to get it to work
bnn121
10-10-2004, 12:16 AM
I'm getting better at this...wish me luck...but where do I find this info and how do yu perform this action?
Add the following Phrases:
**********
Phrase Type: Global
Varname: already_viewed_this_thread
Text: Already viewed this thread:
Phrase Type: Global
Varname: already_viewed_this_thread_since
Text: Already viewed this thread since:
bnn121
10-10-2004, 10:09 PM
Bump
Could some one please tell me where I need to enter the above Phrases?
Is it in the database, if so. how do you do it? tru phpmyadmin?
Is it in the fourm home template...which I did find eventually...and if it there...where do they go?
Please somebody chime in here...or is this a hopeless cause try to install this hack
bnn121
10-10-2004, 10:24 PM
I was able to find it finally...
It in my AdminCP
Would be nice if coders would add a litle something extra to direct us to where these modifications are needed of these hacks/mods for us newbies...
But good work none the less
Ocean
10-10-2004, 11:45 PM
I was able to find it finally...
It in my AdminCP
Would be nice if coders would add a litle something extra to direct us to where these modifications are needed of these hacks/mods for us newbies...
But good work none the less
If you try to hack an application, it is assumed that you know how to use it.
vB is not that different. If you are trying to install a hack, it is generally assumed that you have some idea of how to use the stock forum software. If you don't, you can ask for help - and you will generally receive it... But don't criticize others for your own lack of knowledge. :)
bnn121
10-10-2004, 11:59 PM
But don't criticize others for your own lack of knowledge.
I'm sorry...what gave you that idea...not sure where that came from...
All I was suggesting...is that the directions be complete with all necessary hacking information. This would prevent newbies like me having to come to this thread and ask the question I have been asking and then get a response that generally solves the question or raises additional questions that could have been included in the instructions. I realize that there is a format that coders use...thats obvious from looking at most of the text from these hacks/mods. Again it was only a suggestion on my part that if the instructions where a bit more detailed...a lot of the questions on how to do this and how to do that could be eliminated...I was not critiquing anyone...
I agree with you about having some sort of knowledge about the forum software...but not to go into a long history about my lack of knowledge on these hacks and mods...I am...well was faced with having to do these on my own...because I lost my webmaster...and being on a dedicated server...I'm not about to just let anybody access my stuff...so I decided to learn on my own...as I did not have the luxury of a webmaster to do this for me.
So...I apologize to you and to whomever else my last post insulted...not my intention at all.
PS: I have finally got this hack installed and working like a charm...Kodo's to all who made this one work.
Ocean
10-11-2004, 01:08 AM
All I was suggesting...is that the directions be complete with all necessary hacking information. This would prevent newbie?s like me having to come to this thread and ask the question I have been asking and then get a response that generally solves the question or raises additional questions that could have been included in the instructions. I realize that there is a format that coders use...that?s obvious from looking at most of the text from these hacks/mods. Again it was only a suggestion on my part that if the instructions where a bit more detailed...a lot of the questions on how to do this and how to do that could be eliminated...I was not critiquing anyone...
The fact is that there is almost an unlimited level of granularity back that we could go. What level of skill should coders assume you have? Should they assume that you don't know some of the details of the AdminCP? Should they assume that you don't know how to get into the AdminCP? Should they assume that you don't even know what the AdminCP is?
So, you see, coders have to start somewhere.
A reasonable assumption is that if you are ready to modify your board, you should have a reasonable idea of how to use it in its stock form.
Otherwise, instruction files would be 20 times longer, if coders started with a basic tutorial on how to use vBulletin to begin with. :)
PS: I have finally got this hack installed and working like a charm...Kodo's to all who made this one work.
I'm glad you like it. :)
bnn121
10-11-2004, 01:14 AM
Agreed...I was only trying to help...I do appreciate the efforts you and the other coders put forth with these hacks.
May I ask another question...that does not really have ot do with this hack...well sorta.
In the forumhome template...I have four templates installed...all differnet color templates. Is there a way to modify all tmeplates at one time...meaning I modify the first template...and then do something that makes the modifaction to the other three at the same time...or do I need ot make the changes one at a time?
Ocean
10-12-2004, 12:13 PM
In the forumhome template...I have four templates installed...all differnet color templates. Is there a way to modify all tmeplates at one time...meaning I modify the first template...and then do something that makes the modifaction to the other three at the same time...or do I need ot make the changes one at a time?
Well, you can't have four templates in one... However, if I understand you correctly in that you have four versions, than yes - you can do what you want. Just make the other color versions Child Styles of the primary one. That way, you can just make changes to the parent - and those changes will filter down to the child styles.
theArchitect
10-17-2004, 12:24 AM
Well, you can't have four templates in one... However, if I understand you correctly in that you have four versions, than yes - you can do what you want. Just make the other color versions Child Styles of the primary one. That way, you can just make changes to the parent - and those changes will filter down to the child styles. Super idea for a hack. Very useful. :)
*theArchitect clicks install*.
Though, for some reason the "Already viewed this thread since:" is displaying "never" rather than a date and time shown in your screen shot. Have I messed something up in the install?
BTW, I found the install process very simple, but I amended the SHOWTHREAD template as I have currently active users at the top and not the bottom.
Also, and I don't know if this is of interest to anyone. When I downloaded the .txt file and opening it in the default app text edit everything was fine. But when I opened the file in my editor of choice (BBEdit) I got some strange symbols. And if anyone says, that?s Mac?s for you they are a dead man.
Ocean
10-17-2004, 12:32 AM
Super idea for a hack. Very useful. :)
Thanks! :)
*theArchitect clicks install*.
Though, for some reason the "Already viewed this thread since:" is displaying "never" rather than a date and time shown in your screen shot. Have I messed something up in the install?
Not at all. It will show "Never" if you have never reset the counter for that particular thread. Try resetting it, you'll see that it will now show the date and time you last reset it. :)
Until the first time you reset the second counter for any given thread, the second counter will show the exact same results as the first.
BTW, I found the install process very simple, but I amended the SHOWTHREAD template as I have currently active users at the top and not the bottom.
Also, and I don't know if this is of interest to anyone. When I downloaded the .txt file and opening it in the default app text edit everything was fine. But when I opened the file in my editor of choice (BBEdit) I got some strange symbols. And if anyone says, that?s Mac?s for you they are a dead man.
Well, I won't say it then. But it would seem that I don't need to, either... <grin>
theArchitect
10-17-2004, 02:03 AM
Thanks! :)
Not at all. It will show "Never" if you have never reset the counter for that particular thread. Try resetting it, you'll see that it will now show the date and time you last reset it. :)
Until the first time you reset the second counter for any given thread, the second counter will show the exact same results as the first.
Well, I won't say it then. But it would seem that I don't need to, either... <grin> So I need to hit reset for all of my threads?????
Is there a short cut to do them all. I have one or two of them.
edit:
Err. I just hit reset counter and got:
Fatal error: Call to undefined function: is_member_of() in \forum\misc.php on line 8
Help...
Ocean
10-17-2004, 02:15 AM
So I need to hit reset for all of my threads?????
Is there a short cut to do them all. I have one or two of them.
No, you don't have to hit Reset on any of them until you have the need/desire to. The second counter is there to give you a date/timestamped resettable list of users who have viewed that thread. You don't need to Reset any given thread unless/until you have the need/desire to see who will have viewed that thread from that point on.
Otherwise, you can just leave them be. :)
edit:
Err. I just hit reset counter and got:
Fatal error: Call to undefined function: is_member_of() in \forum\misc.php on line 8
Help...
The function "is_member_of" is called from the code this hack adds to misc.php. However, it is a vB function.
The problem is that the error message states that you put that addition in the very beginning of the misc.php file (before the global functions are pre-loaded). You need to move the hack's added code to the right place in Misc.php - refer to the instructions for details. :)
theArchitect
10-17-2004, 02:00 PM
Thankyou Ocean. Your prompt and accurate advice is most appreciated.
Ocean
10-17-2004, 03:44 PM
Thankyou Ocean. Your prompt and accurate advice is most appreciated.
You're very welcome! :)
bnn121
10-21-2004, 08:48 AM
This is a great hack...but...is there a way to pick and choose who can see this?
Meaning...right now all admins can see the hack...but no supermods or regualr mods. I no it may be some work. Is there a section that can be edited to allow additional userid to view this hack?
Ocean
10-21-2004, 02:05 PM
This is a great hack...but...is there a way to pick and choose who can see this?
Meaning...right now all admins can see the hack...but no supermods or regualr mods. I no it may be some work. Is there a section that can be edited to allow additional userid to view this hack?
No problem. :)
See my following post about the new version. :)
Edit: I released a new version initially, but I subsequently pulled it, because I wanted to make the Security settings easier to work with. Give me a bit, and I'll post the new version here. :)
Ocean
10-21-2004, 07:05 PM
Hi, all! I have just released v1.2.5 of this hack.
The only changes that were made, was to allow for more flexibility in deciding who could view this hack, and the ease that you could choose which Security Layout you wanted to use (No more "remove this" or "uncomment that". Now, other than choosing which UserGroups you want to have access to this hack, you only have to change ONE variable in order to select which Security Option you want to use). :)
As before - by default, only Admins can see any of the "Who Viewed" information, and only Admins can Reset the second section.
However, if you wish to change this, there are now three options you can choose from:
Option 1: If you want ALL users to be able to see BOTH sections of "Who Viewed" information.
Option 2: If you want to specify ONLY certain UserGroups IN ADDITION to Admins that can see BOTH sections of "Who Viewed" information.
Option 3: If you want ALL users to see the first section of "Who Viewed" information, but wish to specify that ONLY certain UserGroups can see the second section of "Who Viewed" information.
Regardless of which option you choose, ONLY Admins can Reset the second section.
If the default security setup is fine with you, than installation is mostly just a matter of inserting code where instructed.
However, if you want to choose any of the other security options, instructions are in the code changes for the ShowThread.php file. It's a LOT easier now. :)
If anyone wishes to upgrade from 1.2.1 to 1.2.5, all you have to do is replace the code additions to ShowThread.php and the SHOWTHREAD Template from the new instructions.
Then, if you wish to modify the security settings, follow the instructions in the ShowThread.php section to do so. :)
bnn121
10-23-2004, 10:45 AM
I just finished installing your newest release...and this is one great hack...but I have one question.
If you click on the Who viewed this thread's minimize arrow to collapse that box it does just fine...but if you try the same thing with the who viewed this thread since...it does not collapse that box...it collapse the who viewed this thread since instead.
What part of the code handles the collapsing of the boxes...so I may check and see if I made an error.
Ocean
10-23-2004, 02:45 PM
I just finished installing your newest release...and this is one great hack...but I have one question.
If you click on the Who viewed this thread's minimize arrow to collapse that box it does just fine...but if you try the same thing with the who viewed this thread since...it does not collapse that box...it collapse the who viewed this thread since instead.
What part of the code handles the collapsing of the boxes...so I may check and see if I made an error.
Oops! No, that's not your error - that's mine. I never collapse those objects on my own board, so I never noticed that discrepancy.
I fixed the problem and released 1.2.6. Anyone upgrading from v1.2.5 ONLY - can just replace the code added to the SHOWTHREAD Template (Step 6), and you'll be fine.
Anyone upgrading from v1.2.1 to v1.2.6 only needs to replace the code additions to ShowThread.php in addition to the SHOWTHREAD Template. :)
Ocean
10-23-2004, 04:26 PM
Alright, everyone - I have a question for you.
I'm looking at filling the requests that this hack show up as a link which opens a Pop Up Window with the requisite information.
The question I'm posing to all of you is this: if I do this, does anyone still feel that it is beneficial to be able to optionally have the information display on the thread itself (the way it does currently)?
Or would everyone unanimously prefer that it only display the information as a Pop Up?
If everyone wants it as a Pop Up, I may not retain the current format. On the other hand, if there are those who like it as it is - I may make it an option, so that you can select which format you prefer.
Let me know. :)
bnn121
10-23-2004, 04:51 PM
I would like to see it as an option...Mine is set to display on admin and staff...but if this where to be visable boaRd wide...then yes a popup would be nice
rjordan
10-23-2004, 07:51 PM
Personally, I think the popup is what is prefered. You might not want to see who viewed ALL topics, just the ones you really want to monitor. Besides, this might open the door for my previous request ;) !
Torqued
10-26-2004, 01:06 PM
An option to do either would seem to make everyone happy. :)
Ocean
10-26-2004, 04:48 PM
An option to do either would seem to make everyone happy. :)
That's what I figured.
Well, everyone - I'm working on the next version, which will have a user-selectable option to make the "Who Viewed" information available via a Pop Up Window (or, you could choose to see them on the ShowThread page, as it is now). :)
I should have it released this week, if all goes well. :)
Ocean
10-26-2004, 07:27 PM
Alright everyone!
I have just released v1.3.0 of this hack, and I have given you what you asked for: the ability to have the Who Viewed information displayed in a Pop Up, instead of directly in the ShowThread page. :)
I made it so that you can choose which Display Mode you prefer - to have the Who Viewed information show up directly on the ShowThread page (as it was for all prior versions), or to only show a Link on the ShowThread page that opens a Pop Up Window with the Who Viewed information there.
I also consolidated and cleaned up the code - so now (among other changes) there is a distinct Configuration Section in the ShowThread.php code addition.
For users upgrading from v1.2.6 (and these instructions ONLY apply to users coming from v1.2.6), download the v1.3.0 instructions and do the following:
1. Remove the code addition you previously had added to Misc.php. It is no longer needed.
2. Follow Steps 3-4 in the v1.3.0 Instructions file.
3. Replace the old (v1.2.6) code additions to ShowThread.php with the new version of code (Steps 5-6).
4. Replace the old (v1.2.6) code additions to the SHOWTHREAD Template with the new version of code (Steps 8-9).
5. Follow Steps 10-11 in the v1.3.0 Instructions file.
6. Test to make sure the hack works properly (do this BEFORE you change anything in the Configuration Section).
7. Optional: Edit the Configuration Section in the new Code you just added.
That's it!
Let me know what you think of the new Pop Up functionality! :)
Torqued
10-26-2004, 07:31 PM
Alright everyone!
I have just released v1.3.0 of this hack, and I have given you what you asked for: the ability to have the Who Viewed information displayed in a Pop Up, instead of directly in the ShowThread page. :)
:angry: Darn you for being so efficient!
I had just installed 1.2.6 this morning! :D
Thanks! Will try out the upated mod this evening. :) :banana:
Ocean
10-26-2004, 07:38 PM
:angry: Darn you for being so efficient!
I had just installed 1.2.6 this morning! :D
Thanks! Will try out the upated mod this evening. :) :banana:
Sorry about that! :)
I know how much I hate waiting weeks or months for other developers to make changes or improvements - so I try to not do the same thing.
If it really bothers you, I could start waiting a month or two longer than necessary before releasing new versions... <grin>
Torqued
10-27-2004, 05:37 PM
Sorry about that! :)
I know how much I hate waiting weeks or months for other developers to make changes or improvements - so I try to not do the same thing.
If it really bothers you, I could start waiting a month or two longer than necessary before releasing new versions... <grin>
Nooooooooo! :confused: :D
Ocean
10-27-2004, 10:03 PM
Nooooooooo! :confused: :D
Oh, all right then. Just for you, I released v1.3.1. <grin>
There are no functional changes with v1.3.1 (versus v1.3.0) - I made some minor improvements to the aesthetics, that's all.
I updated the screenshots on the first post in this thread - so you can take a look and decide if you want those changes now, or if you'd rather wait until the next functional release. :)
For anyone upgrading from v1.3.0 to v1.3.1 - just replace the code inserted into the SHOWTHREAD Template, as well as the entire contents of the WhoViewedTemplate Template. That's it. You're not overwriting any configuration settings - so it's just two quick replacements and you're completely done. :)
rh2004
12-01-2004, 01:30 PM
Hi im confused I done the phrase but and all upto number 6 then I have no idea
what this is talking about, is it a New template, a new file :(
6. Above, Add:
**********
################################################## ##############################
########################## Who Viewed This Thread ##############################
########################## CONFIGURATION ##############################
################################################## ##############################
/*
By default, only Admins can see either of the two sections of "Who Viewed" information, and only Admins can Reset the second section.
There are three ways you can deviate from this default setup (Regardless of which deviation you may choose, ONLY admins can Reset the second section):
OPTION 1: If you want ALL users to be able to see BOTH sections of "Who Viewed" information...
Located immediately below these three options, you will find a line that starts with "$whoviewed_security_option = ". The number that follows the equals sign indicates which Security Option you wish to use (It is set to "2" by default). For Option 1, change the number "2" to a "1".
OPTION 2: If you want to specify ONLY certain UserGroups IN ADDITION to Admins that can see BOTH sections of "Who Viewed" information...
Located immediately below these three options, you will find a line that starts with "$whoviewed_security_option = ". The number that follows the equals sign indicates which Security Option you wish to use (It is set to "2" by default). For Option 2, change the number to "2", if it is not already set that way.
In addition, in the following section of code, insert the Usergroup IDs of the User Groups that you want this hack to work for. Each UserGroup ID needs to be surrounded by single-quotes ( ' ), and all but the last one needs to have a comma after each entry. In the following example, UserGroups 6 and 5 have been specified (although the actual code to be executed only specifies UserGroup 6). Change this to suit your needs.
**********************************************
EXAMPLE
**********************************************
$whoviewed_selective_usergroups = array(
'6',
'5'
);
**********************************************
END OF EXAMPLE
**********************************************
*/
// List of Approved UserGroups
$whoviewed_selective_usergroups = array(
'6'
);
/*
OPTION 3: If you want ALL users to see the first section of "Who Viewed" information, but wish to specify that ONLY certain UserGroups can see the second section of "Who Viewed" information...
Located immediately below these three options, you will find a line that starts with "$whoviewed_security_option = ". The number that follows the equals sign indicates which Security Option you wish to use (It is set to "2" by default). For Option 3, change the number "2" to a "3".
In addition, set the List of Approved UserGroups above as described in Option 2.
*/
// Set the number on this line equal to which Security Option you chose. It is set to 2, by default.
$whoviewed_security_option = 2;
/*
DISPLAY METHOD:
Display Option 1: All "Who Viewed" information is displayed right on the ShowThread page.
Display Option 2: The ShowThread page will have a link which opens a Pop Up Window with the "Who Viewed" information.
*/
// Set the number on this line equal to which Display Option you chose. It is set to 1, by default.
$whoviewed_display_option = 1;
################################################## ##############################
########################## End of ##############################
########################## Who Viewed This Thread ##############################
########################## CONFIGURATION ##############################
################################################## ##############################
// Section - Check if user has already viewed thread, and add UserID if they have not
$showinvisible = 1;
// Get who has already viewed this thread
$currentthread = $DB_site->query_first("SELECT whoviewed FROM ".TABLE_PREFIX."thread WHERE threadid = $threadid");
$currentthread2 = $DB_site->query_first("SELECT whoviewedcounter FROM ".TABLE_PREFIX."thread WHERE threadid = $threadid");
$userinfo = fetch_userinfo($bbuserinfo['userid']);
if (!$userinfo['invisible'] OR $showinvisible)
{
if (!empty($currentthread['whoviewed']))
{
$vieweduserids = explode(",", $currentthread['whoviewed']);
if (!in_array($bbuserinfo['userid'], $vieweduserids))
{
$adduserid = ",".$bbuserinfo[userid];
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewed = CONCAT(whoviewed, '$adduserid') WHERE threadid = $threadid");
}
}
else
{
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewed = $bbuserinfo[userid] WHERE threadid = $threadid");
}
// Duplicate Set
if (!empty($currentthread2['whoviewedcounter']))
{
$vieweduserids2 = explode(",", $currentthread2['whoviewedcounter']);
if (!in_array($bbuserinfo['userid'], $vieweduserids2))
{
$adduserid = ",".$bbuserinfo[userid];
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter = CONCAT(whoviewedcounter, '$adduserid') WHERE threadid = $threadid");
}
}
else
{
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter = $bbuserinfo[userid] WHERE threadid = $threadid");
}
}
// End Section - Check if user has already viewed thread, and add UserID if they have not
// Main "Who Viewed" Function
function whoviewedfunction()
{
// Globalize all variables to that external variables are available within the function, and so internal variables are available outside the function
global $showinvisible, $DB_site, $threadid, $userinfo, $bbuserinfo, $currentthread, $thread, $vbphrase, $user, $session;
global $currentthread, $currentthread2, $vieweduserids, $adduserid, $vieweduserids2, $whoviewed_selective_usergroups, $whoviewed_security_option, $whoviewed_group_approved, $show_whoviewed, $result, $viewers, $result2, $viewers2, $whoviewedreset, $whoviewed_display_option;
// Section - Security - Evaluate if user has permission to view "Who Viewed" information, and which sections they have permissions to access
if ((in_array($bbuserinfo['usergroupid'], $whoviewed_selective_usergroups)) OR (in_array($bbuserinfo['membergroupids'], $whoviewed_selective_usergroups)))
{
$whoviewed_group_approved = true;
}
else
{
$whoviewed_group_approved = false;
}
if ( ($whoviewed_group_approved == true) OR ($whoviewed_security_option == 1) OR ($whoviewed_security_option == 3))
{
$show_whoviewed = true;
// End Section - Security - Evaluate if user has permission to view "Who Viewed" information, and which sections they have permissions to access
// Section - Get list of users who has viewed this thread - First Counter
if (empty($currentthread['whoviewed']))
{
$thread['viewers'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread[whoviewed])");
$viewers = array();
while ($user = $DB_site->fetch_array($result))
{
array_push($viewers, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewers'] = implode(", ", $viewers);
}
// End Section - Get list of users who has viewed this thread - First Counter
// Section - Get list of users who has viewed this thread - Second Counter
if (empty($currentthread2['whoviewedcounter']))
{
$thread['viewerscounter'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result2 = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread2[whoviewedcounter])");
$viewers2 = array();
while ($user = $DB_site->fetch_array($result2))
{
array_push($viewers2, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewerscounter'] = implode(", ", $viewers2);
}
// End Section - Get list of users who has viewed this thread - Second Counter
// Section - Get the date/time of last reset
if ($thread['whoviewedreset'] != '0')
{
// $whoviewedreset = vbdate($vboptions[dateformat], '$thread[whoviewedreset]');
$whoviewedreset = vbdate("m/d/Y - h:i a", $thread[whoviewedreset]);
}
else
{
$whoviewedreset = "Never";
}
// End Section - Get the date/time of last reset
}
else
{
$show_whoviewed = false;
}
}
// End of Main "Who Viewed" Function
if ($whoviewed_display_option == 1)
{
whoviewedfunction();
}
if ($_REQUEST['do'] == 'whoviewedpopup')
{
// global.php handles $threadid..
//$threadid = intval($threadid);
$thread = verify_id('thread', $threadid, 1, 1);
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & CANVIEW))
{
print_no_permission();
}
if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR !$bbuserinfo['userid']))
{
print_no_permission();
}
whoviewedfunction();
unset($shutdownqueries['pmpopup']);
eval('print_output("' . fetch_template('WhoViewedTemplate') . '");');
}
if ($_REQUEST['do'] == "resetwhoviewedcounter")
{
if(!is_member_of($bbuserinfo, 6)) // only admins may reset counter (usergroup: 6)
{
print_no_permission();
}
$threadid = addslashes($_REQUEST['threadid']);
//***insert mysql queries
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter='' WHERE threadid=$threadid");
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedreset = " . TIMENOW . " WHERE threadid = $threadid");
if ($whoviewed_display_option == 1)
{
//redirect back to thread
$url = "showthread.php?$session[sessionurl]t=$threadid";
eval(print_standard_redirect('redirecting'));
}
if ($whoviewed_display_option == 2)
{
//redirect back to Pop Up Window
$url = "showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid";
eval(print_standard_redirect('redirecting'));
}
}
********************************
7. Optional Step: In the code you just added in the previous step, there is a Configuration Section. If you wish, you can modify this hack's behavior and permissions there. Instructions can be found within the Configuration Section.
********************************
8. Open the "SHOWTHREAD" template and Find:
**********
<!-- forum rules and admin links -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
********************************
9. Above, Add:
**********
<br/>
<!-- Section - If the Display Option is set to Pop Up, show the Pop Up Link -->
<if condition="$whoviewed_display_option == 2">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="2">
<a href="showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid" target="threadpop" onclick="window.open(this.href, this.target, 'width=640, height=400, resizable'); return false;">List users who viewed this thread</a>
</td>
</tr>
</table>
<br/>
<br/>
</if>
<!-- End Section - If the Display Option is set to Pop Up, show the Pop Up Link -->
<!-- Section - If the Display Option is set to ShowThread, show the Who Viewed information right on the ShowThread page -->
<if condition="$whoviewed_display_option == 1">
<!-- Master Section - Display Who Viewed information, based on permissions. -->
<!-- Section Note: "WhoViewedTemplate" Template has a mirror of this section -->
<if condition="$show_whoviewed">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tbody>
<tr>
<td class="tcat" colspan="2">
<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed1')"><img id="collapseimg_whoviewed1" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>
$vbphrase[already_viewed_this_thread]
</td>
</tr>
</tbody>
<tbody id="collapseobj_whoviewed1" style="">
<tr>
<td class="alt1" colspan="2">
<span class="smallfont">$thread[viewers]</span>
</td>
</tr>
</tbody>
</table>
<br />
</if>
<if condition="$whoviewed_group_approved OR $whoviewed_security_option == 1">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tbody>
<tr>
<td class="tcat" colspan="2">
<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed2')"><img id="collapseimg_whoviewed2" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>
$vbphrase[already_viewed_this_thread_since]   $whoviewedreset    
<if condition="is_member_of($bbuserinfo,6)">
(<a href="showthread.php?$session[sessionurl]do=resetwhoviewedcounter&t=$threadid">Reset Counter</a>)
</if>
</td>
</tr>
</tbody>
<tbody id="collapseobj_whoviewed2" style="">
<tr>
<td class="alt1" colspan="2">
<span class="smallfont">$thread[viewerscounter]</span>
</td>
</tr>
</tbody>
</table>
<br />
<br />
</if>
<!-- End Master Section - Display Who Viewed information, based on permissions. -->
</if>
<!-- End Section - If the Display Option is set to ShowThread, show the Who Viewed information right on the ShowThread page -->
********************************
10. In the Parent Style of your choice, create a New Template (Style Manager/<Pulldown Menu> Add New Template) with the following information:
**********
New Template Title: WhoViewedTemplate
********************************
11. For the contents of this New Template - "WhoViewedTemplate", enter the following:
**********
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>Who Viewed this Thread? - $vboptions[bbtitle]</title>
$headinclude
</head>
<body onload="self.focus()" style="margin:0px">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<tr>
<td class="tcat" colspan="1">
Who Viewed this Thread?
<div class="smallfont">Thread: <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">$thread[title]</a></div>
</td>
</tr>
</table>
<br/>
<br/>
<!-- Mirror Section - Display Who Viewed information, based on permissions. -->
<!-- Section Note: This is a mirror of the Master Section, located in the ShowThread Template addition. -->
<if condition="$show_whoviewed">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tbody>
<tr>
<td class="tcat" colspan="2">
<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed1')"><img id="collapseimg_whoviewed1" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>
$vbphrase[already_viewed_this_thread]
</td>
</tr>
</tbody>
<tbody id="collapseobj_whoviewed1" style="">
<tr>
<td class="alt1" colspan="2">
<span class="smallfont">$thread[viewers]</span>
</td>
</tr>
</tbody>
</table>
<br />
</if>
<if condition="$whoviewed_group_approved OR $whoviewed_security_option == 1">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tbody>
<tr>
<td class="tcat" colspan="2">
<a style="float:right" href="#top" onclick="return toggle_collapse('whoviewed2')"><img id="collapseimg_whoviewed2" src="images/buttons/collapse_tcat.gif" alt="" border="0" /></a>
$vbphrase[already_viewed_this_thread_since]   $whoviewedreset    
<if condition="is_member_of($bbuserinfo,6)">
(<a href="showthread.php?$session[sessionurl]do=resetwhoviewedcounter&t=$threadid">Reset Counter</a>)
</if>
</td>
</tr>
</tbody>
<tbody id="collapseobj_whoviewed2" style="">
<tr>
<td class="alt1" colspan="2">
<span class="smallfont">$thread[viewerscounter]</span>
</td>
</tr>
</tbody>
</table>
<br />
<br />
</if>
<!-- End Mirror Section - Display Who Viewed information, based on permissions. -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<tr>
<td class="tfoot" colspan="1" align="center"><div class="smallfont">
<a href="#" onclick="self.close();"><strong>$vbphrase[close_this_window]</strong></a>
</div></td>
</tr>
</table>
</body>
</html>
********************************
Installation Complete!
Can someone explain please
Ocean
12-01-2004, 01:38 PM
Hi im confused I done the phrase but and all upto number 6 then I have no idea
what this is talking about, is it a New template, a new file :(
Can someone explain please
It should be self-explanatory.
Step 5 tells you to find a bit of code in the ShowThread.php file. Step 6 tells you to insert the following segment above the code you found in Step 5.
The segment is defined as the code between
********************************
6. Above, Add:
**********
Insert the code that appears between these two lines of asterisks.
********************************
7. Optional Step: In the code you just added in the previous step, there is a Configuration Section. If you wish, you can modify this hack's behavior and permissions there. Instructions can be found within the Configuration Section.
********************************
rh2004
12-01-2004, 01:46 PM
So for no 6 I just add:
**********
whats the CONFIGURATION ?
Ocean
12-01-2004, 01:51 PM
So for no 6 I just add:
**********
whats the CONFIGURATION ?
No, you don't add the asterisks right beneath the instructions for Step 6 - those are meant to be seperators (the same as the last 5 instructions before them) - you add what's between the asterisks. Follow the instructions.
As for the Configuration section - the information you need is written out right there for you. Read it, and you'll understand.
rh2004
12-01-2004, 02:26 PM
Hi, I did it this is my showthread.php file...
$whoviewed_group_approved = true;
}
else
{
$whoviewed_group_approved = false;
}
if ( ($whoviewed_group_approved == true) OR ($whoviewed_security_option == 1) OR ($whoviewed_security_option == 3))
{
$show_whoviewed = true;
// End Section - Security - Evaluate if user has permission to view "Who Viewed" information, and which sections they have permissions to access
// Section - Get list of users who has viewed this thread - First Counter
if (empty($currentthread['whoviewed']))
{
$thread['viewers'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread[whoviewed])");
$viewers = array();
while ($user = $DB_site->fetch_array($result))
{
array_push($viewers, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewers'] = implode(", ", $viewers);
}
// End Section - Get list of users who has viewed this thread - First Counter
// Section - Get list of users who has viewed this thread - Second Counter
if (empty($currentthread2['whoviewedcounter']))
{
$thread['viewerscounter'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result2 = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread2[whoviewedcounter])");
$viewers2 = array();
while ($user = $DB_site->fetch_array($result2))
{
array_push($viewers2, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewerscounter'] = implode(", ", $viewers2);
}
// End Section - Get list of users who has viewed this thread - Second Counter
// Section - Get the date/time of last reset
if ($thread['whoviewedreset'] != '0')
{
// $whoviewedreset = vbdate($vboptions[dateformat], '$thread[whoviewedreset]');
$whoviewedreset = vbdate("m/d/Y - h:i a", $thread[whoviewedreset]);
}
else
{
$whoviewedreset = "Never";
}
// End Section - Get the date/time of last reset
}
else
{
$show_whoviewed = false;
}
}
// End of Main "Who Viewed" Function
if ($whoviewed_display_option == 1)
{
whoviewedfunction();
}
if ($_REQUEST['do'] == 'whoviewedpopup')
{
// global.php handles $threadid..
//$threadid = intval($threadid);
$thread = verify_id('thread', $threadid, 1, 1);
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & CANVIEW))
{
print_no_permission();
}
if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR !$bbuserinfo['userid']))
{
print_no_permission();
}
whoviewedfunction();
unset($shutdownqueries['pmpopup']);
eval('print_output("' . fetch_template('WhoViewedTemplate') . '");');
}
if ($_REQUEST['do'] == "resetwhoviewedcounter")
{
if(!is_member_of($bbuserinfo, 6)) // only admins may reset counter (usergroup: 6)
{
print_no_permission();
}
$threadid = addslashes($_REQUEST['threadid']);
//***insert mysql queries
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter='' WHERE threadid=$threadid");
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedreset = " . TIMENOW . " WHERE threadid = $threadid");
if ($whoviewed_display_option == 1)
{
//redirect back to thread
$url = "showthread.php?$session[sessionurl]t=$threadid";
eval(print_standard_redirect('redirecting'));
}
if ($whoviewed_display_option == 1)
{
//redirect back to Pop Up Window
$url = "showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid";
eval(print_standard_redirect('redirecting'));
}
}
//set thread last view
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['pollid'] AND $vboptions['updatelastpost'] AND ($displayed_dateline == $thread['lastpost'] OR $threadview == $thread['lastpost']) AND $pollinfo['lastvote'] > $thread['lastpost'])
{
$displayed_dateline = $pollinfo['lastvote'];
}
There is no errors but I can't see it anywhere....
Ocean
12-01-2004, 02:40 PM
Hi, I did it this is my showthread.php file...
There is no errors but I can't see it anywhere....
Of course you can't. You didn't insert the entire section of code.
rh2004
12-05-2004, 06:54 PM
Hello, sorry but I was confused I worked it out ..
Anyway would you not be able to add the times people viewed the topic
in the next version, and as well as the view count add a drop down menu
which will list the times they viewed the topic in more detail
For example viewed 7 times (click something to bring up in more details +)
test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed
test - the time they viewed
This is my phpbb one that I had for so long, the more details are not on the
phpbb one either is the reset function...
Ocean
12-05-2004, 07:53 PM
Hello, sorry but I was confused I worked it out ..
Anyway would you not be able to add the times people viewed the topic
in the next version, and as well as the view count add a drop down menu
which will list the times they viewed the topic in more detail
I will try to put in a date/time last viewed for each user in the next major version. However, the extensive logs you gave as an example might very well put too much of a load on the Server. I'll consider that option when I add a date/time stamp. :)
When you have $whoviewed_display_option = 2;
Those who are not allowed to view "who viewed list" should NOT see the link "List users who viewed this thread" either
<if condition="$whoviewed_display_option == 2">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="2">
<a href="showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid" target="threadpop" onclick="window.open(this.href, this.target, 'width=640, height=400, resizable'); return false;">List users who viewed this thread
</td>
</tr>
</table>
<br/>
<br/>
</if>
Alright everyone!
I have just released v1.3.0 of this hack, and I have given you what you asked for: the ability to have the Who Viewed information displayed in a Pop Up, instead of directly in the ShowThread page. :)
I made it so that you can choose which Display Mode you prefer - to have the Who Viewed information show up directly on the ShowThread page (as it was for all prior versions), or to only show a Link on the ShowThread page that opens a Pop Up Window with the Who Viewed information there.
That's it!
Let me know what you think of the new Pop Up functionality! :)
rh2004
12-05-2004, 10:19 PM
I will try to put in a date/time last viewed for each user in the next major version. However, the extensive logs you gave as an example might very well put too much of a load on the Server. I'll consider that option when I add a date/time stamp. :)
Thanks
andrew67
12-07-2004, 09:16 AM
going to go install.. it sounds good :) Appreciated.
Ocean
12-15-2004, 01:14 PM
When you have $whoviewed_display_option = 2;
Those who are not allowed to view "who viewed list" should NOT see the link "List users who viewed this thread" either
Thank you for pointing this out. This problem has been fixed in v1.3.2, which I have just released.
Anyone wishing to upgrade from v1.3.1 to v1.3.2 just needs to re-do steps 6 and 9 (replacing the sections in ShowThread.php, and the SHOWTHREAD template).
:)
Ocean
12-15-2004, 01:14 PM
going to go install.. it sounds good :) Appreciated.
I'm glad you like it! :)
IC-Games
12-19-2004, 01:48 AM
getting a currupt download here, some charectors are out of whack for me
Ocean
12-19-2004, 08:20 AM
getting a currupt download here, some charectors are out of whack for me
Which file is giving you problems? Is it the main 1.3.2 Instructions file? If so, I tried downloading it from here and at an initial glance - it seems fine. Perhaps the problem was with your download - and you might want to try it again. :)
I was searching for this mod about week and just know find it
it is the hard mod i ever see .. to install it conf me i dont no what line i should edit or add ..
could u please add for me this mod
// pre-cache templates used by specific actions
$actiontemplates = array();
// ####################### PRE-BACK-END ACTIONS ##########################
function exec_postvar_call_back()
{
global $_REQUEST;
if ($_REQUEST['goto'] == 'lastpost' OR $_REQUEST['goto'] == 'newpost' OR $_REQUEST['goto'] == 'postid')
{
global $noheader;
$noheader = 1;
}
}
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once('./includes/functions_bigthree.php');
require_once('./includes/functions_showthread.php');
require_once('./includes/functions_warning.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
globalize($_REQUEST, array(
'perpage' => INT,
'pagenumber' => INT,
'highlight' => STR,
'posted' => INT,
'goto'
));
$hierarchical=$warn_opts['hierarchical'];
$viewoption=$warn_opts['viewoption'];
$buttons=$warn_opts['textbutoption'];
// ************************************************** *******************************
// set $threadedmode (continued from sessions.php)
if ($vboptions['allowthreadedmode'])
{
if (!isset($threadedmode))
{
DEVDEBUG('$threadedmode is empty');
if ($bbuserinfo['threadedmode'] == 3)
{
$threadedmode = 0;
}
else
{
$threadedmode = $bbuserinfo['threadedmode'];
}
}
switch ($threadedmode)
{
case 1:
$show['threadedmode'] = true;
$show['hybridmode'] = false;
$show['linearmode'] = false;
break;
case 2:
$show['threadedmode'] = false;
$show['hybridmode'] = true;
$show['linearmode'] = false;
break;
default:
$show['threadedmode'] = false;
$show['hybridmode'] = false;
$show['linearmode'] = true;
break;
}
}
else
{
DEVDEBUG('Threadedmode disabled by admin');
$threadedmode = 0;
$show['threadedmode'] = false;
$show['linearmode'] = true;
$show['hybridmode'] = false;
}
// make an alternate class for the selected threadedmode
$modeclass = array();
for ($i = 0; $i < 3; $i++)
{
$modeclass["$i"] = iif($i == $threadedmode, 'alt2', 'alt1');
}
// prepare highlight words
if (!empty($_GET['highlight']))
{
$highlightwords = iif($goto, '&', '&') . 'highlight=' . urlencode($_GET['highlight']);
}
else
{
$highlightwords = '';
}
// ################################################## ############################
// ####################### HANDLE HEADER() CALLS ################################
// ################################################## ############################
switch($goto)
{
// ************************************************** *******************************
// go to next newest
case 'nextnewest':
$thread = verify_id('thread', $threadid, 1, 1);
if ($getnextnewest = $DB_site->query_first("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = thread.threadid AND type = 'thread')
WHERE forumid = $thread[forumid] AND lastpost > $thread[lastpost] AND visible = 1 AND open <> 10
AND deletionlog.primaryid IS NULL
ORDER BY lastpost
LIMIT 1
"))
{
$threadid = $getnextnewest['threadid'];
unset ($thread);
}
else
{
eval(print_standard_error('error_nonextnewest'));
}
break;
// ************************************************** *******************************
// go to next oldest
case 'nextoldest':
$thread = verify_id('thread', $threadid, 1, 1);
if ($getnextoldest = $DB_site->query_first("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = thread.threadid AND type = 'thread')
WHERE forumid = $thread[forumid] AND lastpost < $thread[lastpost] AND visible = 1 AND open <> 10
AND deletionlog.primaryid IS NULL
ORDER BY lastpost DESC
LIMIT 1
"))
{
$threadid = $getnextoldest['threadid'];
unset($thread);
}
else
{
eval(print_standard_error('error_nonextoldest'));
}
break;
// ************************************************** *******************************
// goto last post
case 'lastpost':
$threadid = intval($_REQUEST['threadid']);
if (!empty($_REQUEST['forumid']))
{ // this one needs to stay AS $_REQUEST!
$forumid = verify_id('forum', $forumid, 1, 0);
$thread = $DB_site->query_first("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = thread.threadid AND type = 'thread')
WHERE forumid IN ($foruminfo[childlist]) AND visible = 1 AND (sticky = 1 OR sticky = 0)
AND lastpost >= " . ($foruminfo['lastpost'] - 30) . " AND open <> 10 AND deletionlog.primaryid IS NULL
ORDER BY lastpost DESC
LIMIT 1
");
$threadid = $thread['threadid'];
}
if (!empty($threadid))
{
if ($getlastpost = $DB_site->query_first("
SELECT MAX(postid) AS postid
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND type = 'post')
WHERE threadid = " . intval($threadid) . " AND visible = 1 AND deletionlog.primaryid IS NULL
LIMIT 1
"))
{
if ($threadedmode != 1) // if linear or hybrid
{
exec_header_redirect("showthread.php?$session[sessionurl_js]p=$getlastpost[postid]$highlightwords#post$getlastpost[postid]");
}
else // if threaded
{
$postid = $getlastpost['postid'];
}
}
}
break;
// ************************************************** *******************************
// goto newest unread post
case 'newpost':
$threadinfo = verify_id('thread', $threadid, 1, 1);
if (($tview = fetch_bbarray_cookie('thread_lastview', $threadid)) > $bbuserinfo['lastvisit'])
{
$bbuserinfo['lastvisit'] = $tview;
}
$posts = $DB_site->query_first("
SELECT MIN(postid) AS postid
FROM " . TABLE_PREFIX . "post
WHERE threadid = $threadinfo[threadid] AND visible = 1 AND dateline > $bbuserinfo[lastvisit]
LIMIT 1
");
if ($posts['postid'])
{
exec_header_redirect("showthread.php?$session[sessionurl_js]p=$posts[postid]$highlightwords#post$posts[postid]");
}
else
{
exec_header_redirect("showthread.php?$session[sessionurl_js]t=$threadinfo[threadid]&goto=lastpost$highlightwords");
}
break;
// ************************************************** *******************************
}
// end switch($goto)
// ************************************************** *******************************
// workaround for header redirect issue from forms with enctype in IE
// (use a scrollIntoView javascript call in the <body> onload event)
$onload = '';
// ************************************************** *******************************
// set $perpage
if (!$perpage)
{
$perpage = $bbuserinfo['maxposts'];
}
$checkmax = explode(',', $vboptions['usermaxposts'] . ',' . $vboptions['maxposts']);
if ($perpage < 1 OR $perpage > max($checkmax))
{
$perpage = $vboptions['maxposts'];
}
// ************************************************** *******************************
// set post order
if ($bbuserinfo['postorder'] == 0)
{
$postorder = '';
}
else
{
$postorder = 'DESC';
}
// ************************************************** *******************************
// get thread info
$thread = verify_id('thread', $threadid, 1, 1);
$threadinfo = &$thread;
// ************************************************** *******************************
// check for visible / deleted thread
if ((!$thread['visible'] OR $thread['isdeleted']) AND !can_moderate($thread['forumid']))
{
$idname = $vbphrase['thread'];
eval(print_standard_error('error_invalidid'));
}
// ************************************************** *******************************
// jump page if thread is actually a redirect
if ($thread['open'] == 10)
{
exec_header_redirect("showthread.php?$session[sessionurl_js]t=$thread[pollid]");
}
// ************************************************** *******************************
// Tachy goes to coventry
if (in_coventry($thread['postuserid']) AND !can_moderate($thread['forumid']))
{
$idname = $vbphrase['thread'];
eval(print_standard_error('error_invalidid'));
}
// ************************************************** *******************************
// do word wrapping for the thread title
if ($vboptions['wordwrap'] != 0)
{
$thread['title'] = fetch_word_wrapped_string($thread['title']);
}
// ************************************************** *******************************
// words to highlight from the search engine
if (!empty($highlight))
{
$highlight = preg_replace('#\*+#s', '*', $highlight);
if ($highlight != '*')
{
$regexfind = array('\*', '\<', '\>');
$regexreplace = array('[\w.:@*/?=]*?', '<', '>');
$highlight = preg_quote(strtolower($highlight), '#');
$highlight = explode(' ', $highlight);
$highlight = str_replace($regexfind, $regexreplace, $highlight);
foreach ($highlight AS $val)
{
if ($val = trim($val))
{
$replacewords[] = htmlspecialchars_uni($val);
}
}
}
}
// ************************************************** *******************************
// make the forum jump in order to fill the forum caches
$curforumid = $thread['forumid'];
construct_forum_jump();
// ************************************************** *******************************
// get forum info
$forum = fetch_foruminfo($thread['forumid']);
$foruminfo = &$forum;
// ************************************************** *******************************
// check forum permissions
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & CANVIEW))
{
print_no_permission();
}
if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR $bbuserinfo['userid'] == 0))
{
print_no_permission();
}
// ************************************************** *******************************
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
// ************************************************** *******************************
// get ignored users
$ignore = array();
if (trim($bbuserinfo['ignorelist']))
{
$ignorelist = preg_split('/( )+/', trim($bbuserinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
foreach ($ignorelist AS $ignoreuserid)
{
$ignore["$ignoreuserid"] = 1;
}
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
// ************************************************** *******************************
// filter out deletion notices if can't be seen
if (!($forumperms & CANSEEDELNOTICE) AND !can_moderate($threadinfo['forumid']))
{
$delthreadlimit = "AND deletionlog.primaryid IS NULL";
$deljoin = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(post.postid = deletionlog.primaryid AND type = 'post')";
$linkdeleted = false;
}
else
{
$delthreadlimit = '';
$deljoin = '';
$linkdeleted = true;
}
$show['viewpost'] = iif(can_moderate($thread['forumid']), true, false);
$show['managepost'] = iif(can_moderate($thread['forumid'], 'candeleteposts') OR can_moderate($thread['forumid'], 'canremoveposts'), true, false);
// ************************************************** *******************************
// find the page that we should be on to display this post
if (!empty($postid) AND $threadedmode == 0)
{
$postinfo = verify_id('post', $postid, 1, 1);
$threadid = $postinfo['threadid'];
$getpagenum = $DB_site->query_first("
SELECT COUNT(*) AS posts
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND type = 'post')
WHERE threadid = $threadid AND visible = 1 AND deletionlog.primaryid IS NULL
AND dateline " . iif(!$postorder, '<=', '>=') . " $postinfo[dateline]
");
$pagenumber = ceil($getpagenum['posts'] / $perpage);
}
// ************************************************** *******************************
// update views counter
if ($vboptions['threadviewslive'])
{
// doing it as they happen
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "thread
SET views = views + 1
WHERE threadid = " . intval($threadinfo['threadid'])
);
}
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "threadviews (threadid)
VALUES (" . intval($threadinfo['threadid']) . ')'
);
}
// ## <ucs>
if ($vboptions['uttpoints_enablesystem'] == '1')
{ // It's enabled! Yay!
if ($thread['postuserid'] != $bbuserinfo['userid'])
{ // Don't give points if the user viewing the thread is the one who created it.
if ($vboptions['uttpoints_perview'] != '0' && $forum['uttpoints_perview'] != '0')
{ // Both needed values are not 0... good.
$givethempoints = ($vboptions['uttpoints_perview'] * $forum['uttpoints_perview']);
}
}
if (isset($givethempoints))
{ // If they get money....
// Send the query and we're done.
$DB_site->shutdown_query("UPDATE ".TABLE_PREFIX . $vboptions[uttpoints_pointtable]." SET ".$vboptions[uttpoints_pointsfield]."=".$vboptions[uttpoints_pointsfield]."+".$givethempoints." WHERE userid='$thread[postuserid]'");
}
}
// ## </ucs>
// ************************************************** *******************************
// display ratings if enabled
$show['rating'] = false;
if ($forum['allowratings'] == 1)
{
if ($thread['votenum'] > 0)
{
$thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2);
$thread['rating'] = round($thread['votetotal'] / $thread['votenum']);
if ($thread['votenum'] >= $vboptions['showvotes'])
{
$show['rating'] = true;
}
}
devdebug("threadinfo[vote] = $threadinfo[vote]");
if ($threadinfo['vote'])
{
$voteselected["$threadinfo[vote]"] = HTML_SELECTED;
$votechecked["$threadinfo[vote]"] = HTML_CHECKED;
}
else
{
$voteselected[0] = HTML_SELECTED;
$votechecked[0] = HTML_CHECKED;
}
}
// ************************************************** *******************************
// get some vars from the referring page in order
// to put a nice back-to-forum link in the navbar
/*
unset($back);
if (strpos($_SERVER['HTTP_REFERER'], 'forumdisplay') !== false)
{
if ($vars = strchr($_SERVER['HTTP_REFERER'], '&'))
{
$pairs = explode('&', $vars);
foreach ($pairs AS $v)
{
$var = explode('=', $v);
if ($var[1] != '' and $var[0] != 'forumid')
{
$back["$var[0]"] = $var[1];
}
}
}
}
*/
// ************************************************** *******************************
// set page number
if ($pagenumber < 1)
{
$pagenumber = 1;
}
else if ($pagenumber > ceil(($thread['replycount'] + 1) / $perpage))
{
$pagenumber = ceil(($thread['replycount'] + 1) / $perpage);
}
// ************************************************** *******************************
// initialise some stuff...
$limitlower = ($pagenumber - 1) * $perpage;
$limitupper = ($pagenumber) * $perpage;
$counter = 0;
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
$displayed_dateline = 0;
i really dont understand it .. and this mod is very importen .. i give u my showthread.php i have also modify it and i add a few mods so if u can help me to add it ..
thankyou :nervous:
Ocean
02-09-2005, 10:52 AM
I was searching for this mod about week and just know find it
it is the hard mod i ever see .. to install it conf me i dont no what line i should edit or add ..
could u please add for me this mod
i really dont understand it .. and this mod is very importen .. i give u my showthread.php i have also modify it and i add a few mods so if u can help me to add it ..
thankyou :nervous:
H2k, I'm not going to do your work for you.
This is not a difficult hack to install. The instructions are clear - and most of it is a matter of finding a particular line of code and inserting additional code either above or below the section you were asked to find.
If you read the instructions carefully, you should not have a problem installing it.
Hello
let me tell u the truth i always dont like any one to make my job .. becz i like to learn .. but the truth from your mod .. is really hard.. i have add over then 30 mod in my board.. never is ee a hard mod .. like yours..
becz it is really conf.. as my english is bad..
like ud ont see
after this line add
b4 this line add.
i really can't understand the installing file u have.. it is conf .. really i read it over then 20 time .. i try to make evrything and still not work some time give me error some time .. the view thread dose not show .. and so on
ok i need a help from u to let me undersand this ..
// pre-cache templates used by specific actions
$actiontemplates = array();
I Replace it with
// pre-cache templates used by specific actions
$actiontemplates = array(
'whoviewedpopup' => array(
'WhoViewedTemplate'
)
);
Fine
fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
B4 ADD
// ************************************************** *******************************
// initialise some stuff...
$limitlower = ($pagenumber - 1) * $perpage;
$limitupper = ($pagenumber) * $perpage;
$counter = 0;
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
$displayed_dateline = 0;
################################################## ##############################
########################## Who Viewed This Thread ##############################
########################## CONFIGURATION ##############################
################################################## ##############################
Know after i add this the last one u tell should i add the code from
// Section - Check if user has already viewed thread, and add UserID if they have not
TO
//redirect back to Pop Up Window
$url = "showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid";
eval(print_standard_redirect('redirecting'));
}
}
this is i dont understand reasly what code i need to add in this part .. if u can tell me what code .. it will be easy my english is really bad.. and i hope that with your reply u can Tell me example after that put this code.. and iwill be done with this mod
Ocean
02-09-2005, 06:40 PM
Hello
Fine
fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
B4 ADD
// ************************************************** *******************************
// initialise some stuff...
$limitlower = ($pagenumber - 1) * $perpage;
$limitupper = ($pagenumber) * $perpage;
$counter = 0;
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
$displayed_dateline = 0;
That's not the sole amount of code you're supposed to add at that point. You need to add everything BETWEEN
********************************
6. Above, Add:
**********
And this:
********************************
7. Optional Step: In the code you just added in the previous step, there is a Configuration Section. If you wish, you can modify this hack's behavior and permissions there. Instructions can be found within the Configuration Section.
********************************
Know after i add this the last one u tell should i add the code from
// Section - Check if user has already viewed thread, and add UserID if they have not
TO
//redirect back to Pop Up Window
$url = "showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid";
eval(print_standard_redirect('redirecting'));
}
}
this is i dont understand reasly what code i need to add in this part .. if u can tell me what code .. it will be easy my english is really bad.. and i hope that with your reply u can Tell me example after that put this code.. and iwill be done with this mod
No, you're not supposed to add anything. Those are not part of the instructions. That's part of the code you should have added in the previous step.
The instructions are all formatted in an identical manner - they are located between single lines of asterisks, and each instructional step is prefixed with that step's Number.
The problem is that you are not looking for where each instruction begins and ends - you are reading the middle of the code and assuming that it's part of the install instructions, which it is not.
There *is* a configuration section - but that is located within code that you are supposed to be adding. Step 7 indicates this, and tells you that you can optionally configure this hack's behavior by editing the Configuration Section - after it's been added in the appropriate place.
Jadelit
02-10-2005, 04:42 AM
Is there any way to add the usergroup colors to the list as well?
Hi, I did it this is my showthread.php file...
$whoviewed_group_approved = true;
}
else
{
$whoviewed_group_approved = false;
}
if ( ($whoviewed_group_approved == true) OR ($whoviewed_security_option == 1) OR ($whoviewed_security_option == 3))
{
$show_whoviewed = true;
// End Section - Security - Evaluate if user has permission to view "Who Viewed" information, and which sections they have permissions to access
// Section - Get list of users who has viewed this thread - First Counter
if (empty($currentthread['whoviewed']))
{
$thread['viewers'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread[whoviewed])");
$viewers = array();
while ($user = $DB_site->fetch_array($result))
{
array_push($viewers, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewers'] = implode(", ", $viewers);
}
// End Section - Get list of users who has viewed this thread - First Counter
// Section - Get list of users who has viewed this thread - Second Counter
if (empty($currentthread2['whoviewedcounter']))
{
$thread['viewerscounter'] = '('.strtolower($vbphrase['none']).')';
}
else
{
$result2 = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid IN ($currentthread2[whoviewedcounter])");
$viewers2 = array();
while ($user = $DB_site->fetch_array($result2))
{
array_push($viewers2, "<a href=\"member.php?".$session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}
$thread['viewerscounter'] = implode(", ", $viewers2);
}
// End Section - Get list of users who has viewed this thread - Second Counter
// Section - Get the date/time of last reset
if ($thread['whoviewedreset'] != '0')
{
// $whoviewedreset = vbdate($vboptions[dateformat], '$thread[whoviewedreset]');
$whoviewedreset = vbdate("m/d/Y - h:i a", $thread[whoviewedreset]);
}
else
{
$whoviewedreset = "Never";
}
// End Section - Get the date/time of last reset
}
else
{
$show_whoviewed = false;
}
}
// End of Main "Who Viewed" Function
if ($whoviewed_display_option == 1)
{
whoviewedfunction();
}
if ($_REQUEST['do'] == 'whoviewedpopup')
{
// global.php handles $threadid..
//$threadid = intval($threadid);
$thread = verify_id('thread', $threadid, 1, 1);
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & CANVIEW))
{
print_no_permission();
}
if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR !$bbuserinfo['userid']))
{
print_no_permission();
}
whoviewedfunction();
unset($shutdownqueries['pmpopup']);
eval('print_output("' . fetch_template('WhoViewedTemplate') . '");');
}
if ($_REQUEST['do'] == "resetwhoviewedcounter")
{
if(!is_member_of($bbuserinfo, 6)) // only admins may reset counter (usergroup: 6)
{
print_no_permission();
}
$threadid = addslashes($_REQUEST['threadid']);
//***insert mysql queries
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedcounter='' WHERE threadid=$threadid");
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET whoviewedreset = " . TIMENOW . " WHERE threadid = $threadid");
if ($whoviewed_display_option == 1)
{
//redirect back to thread
$url = "showthread.php?$session[sessionurl]t=$threadid";
eval(print_standard_redirect('redirecting'));
}
if ($whoviewed_display_option == 1)
{
//redirect back to Pop Up Window
$url = "showthread.php?$session[sessionurl]do=whoviewedpopup&t=$threadid";
eval(print_standard_redirect('redirecting'));
}
}
//set thread last view
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['pollid'] AND $vboptions['updatelastpost'] AND ($displayed_dateline == $thread['lastpost'] OR $threadview == $thread['lastpost']) AND $pollinfo['lastvote'] > $thread['lastpost'])
{
$displayed_dateline = $pollinfo['lastvote'];
}
There is no errors but I can't see it anywhere....
ohhhhhhhhhhhhhh know i understand i have to copy the whole code..
thankyou very much .. sorry becz my english is really bad so that is why i can't understand
:)
Ocean
02-11-2005, 08:32 PM
Is there any way to add the usergroup colors to the list as well?
If it's not showing up as is, then I'll have to look into it. But I might not incorporate it until the next feature version.
Ocean
02-11-2005, 08:32 PM
ohhhhhhhhhhhhhh know i understand i have to copy the whole code..
thankyou very much .. sorry becz my english is really bad so that is why i can't understand
:)
No problem. :)
No problem. :)
ok there is something maybe u need to fix .. like in my board i always make my self invisble .. some time i dont like the member see me in the thread.. so
can u make that if the invisble user or who make him self invisble dont show .. only for admin like in who is online
it will show only for the admin
like this *Admin
also if u can make a the color for the name it will be nice to know becz i havemake my board full of color for each groups..
and mabye this is good suggest
like u add
Admin {5} Admin6 {6} AdminD {18} this will be great i have see the saem this mod over at phpBB and IPB
it show for each user how many time they view :) like Admin {80} this mean he view it 80 Time
there is a MOD in phpBB it show a full list
like who is online when u check u see all gust where member view topic etc..
the same in who view topic
it take them to anther page and it show how many time this user view this thread and many time he reply It is called Hoistry Topic or something like this .. it have alot of Extra ..
Thankyou :)
Ocean
02-16-2005, 12:12 AM
ok there is something maybe u need to fix .. like in my board i always make my self invisble .. some time i dont like the member see me in the thread.. so
can u make that if the invisble user or who make him self invisble dont show .. only for admin like in who is online
it will show only for the admin
like this *Admin
It's been awhile since I looked at that particular function - but I believe that this hack respects the Invisibility flag, if I remember correctly...
also if u can make a the color for the name it will be nice to know becz i havemake my board full of color for each groups..
As I said earlier, if the colors don't translate now - I may add that in a future version. However, my initial priority would be to include date/time stamps. :)
and mabye this is good suggest
like u add
Admin {5} Admin6 {6} AdminD {18} this will be great i have see the saem this mod over at phpBB and IPB
it show for each user how many time they view :) like Admin {80} this mean he view it 80 Time
there is a MOD in phpBB it show a full list
like who is online when u check u see all gust where member view topic etc..
the same in who view topic
it take them to anther page and it show how many time this user view this thread and many time he reply It is called Hoistry Topic or something like this .. it have alot of Extra ..
Thankyou :)
Having a full history is definitely a lot more involved. I'm reluctant to add that in, simply due to the strain that would cause for the server. But I might add that in as an Admin-configurable option in a future version. :)
Hello
My brother use phpBB and he have over then 20000 Members with over then 250000 post etc..
and his board is fullymodded withphp mods.. and it's so fast here i giv eu some idea about View Hoistry for phpBB
In the forums play we have here.. Reply and view for each topic.. and for reply it will show who reply the user. but view it will not show here is for phpBB
https://vborg.vbsupport.ru/attachment.php?attachmentid=23994&stc=1
for view it will show in pop up
after u enter the topic u wills ee one icons
https://vborg.vbsupport.ru/
after u check the icons it iwll take u to anther page and it willshow alll user who view and how many times and for the admin it will show for each user ips and also Anonymous it will show the how many tme they view and also the ips for the admins.
https://vborg.vbsupport.ru/
also there is options in the profiles for each user .. what topic they view in what forums and how many time they view it .. etc.. u can see the screen shot .
https://vborg.vbsupport.ru/
if u want to see this mods installing i will giv eu a link for phpbbfm and u can download it and see all options it have..
it dont slow the board or naything like what i said my brother use phpBB and he have over then 20000 user and every over then 500 user come at the same time and more.. and the board run fast :laugh:
Thankyou very much and i hope u really get tiime to thinka bout this and update your mods
I am getting an error that says this when trying to do the queries:
An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'ylpforums.thread' doesn't exist
How do I alter the queries to inlcude the name of my forums???
What error u got .. i think the same when i try at the first iu need to copy the whole code
thx :devious:
Vampyre
03-01-2005, 10:47 AM
Works well.
Thanks for the nice work. ;)
shungo
03-10-2005, 10:59 AM
i installed it. all works fine excepted when i reset counter... i see Already viewed this thread since: m/d/Y - h:i a instead of real date/time.
Help pls :)
regards and congrats for this useful hack !
David_R
03-11-2005, 10:57 AM
install file is confusing me.. i cannot understand properly what changes to be made to showthread.php file
Jenta
03-23-2005, 06:31 PM
nice hack but extremely confusing instructions
i will sit here for an hour reading every single thing i can and try to make sense of it
i know i will eventually after very carefull reading but...
Imperial Fritz
03-27-2005, 05:18 AM
Tested with 3.0.7?....
Cause in my showthread.php there's nothing like
// ************************************************** *******************************
//set thread last view
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
instead there is
// ************************************************** *******************************
//set thread last view
if ($thread['pollid'] AND $vboptions['updatelastpost'] AND ($displayed_dateline == $thread['lastpost'] OR $threadview == $thread['lastpost']) AND $pollinfo['lastvote'] > $thread['lastpost'])
{
$displayed_dateline = $pollinfo['lastvote'];
}
So should I add the code aboove this part?...
EDIT:
Well since I like to experiment I did it and seems to work fine. But probably you should change the instructions. :)
If it's not showing up as is, then I'll have to look into it. But I might not incorporate it until the next feature version.
Username formatting doesn't show at all as of now. When could we expect a new release? :)
CrazyLady
04-01-2005, 01:25 AM
maybe I can sneak in here and ask if this can be modified, or a new hack created, to show if ANY member of a user group, (super moderators) has view the board. I would like to see if I can add a icon in the thread list view to tell my moderators if a thread has already been viewed/moderated by another moderator, saving them from having to view it as well... just a simple yes or no output?
anyhoo, just thought I would ask... nice looking hack!
snake-boy
04-12-2005, 04:27 PM
Hi,
This is a fantastic hack, and I installed it with no problems in v3.0.7. Everything seems to be working except there is a critical bit of funcionality missing:
There does not seem to be any way to show the time/date the thread was viewed as there was in the original version of this hack.
The layout of this is SO much better than the original, but without time/date information, it isn't as helpful as it cold be... Is there any way to add time and datestamps to the list of users who viewed the thread?
-snake
aranthorn
05-02-2005, 03:37 PM
Getting something weird. It was working very well, then I started getting a blank white page when resetting counters. Any ideas what I may have done?
Actually, you can accomplish that function right now. In fact, it's easy when it's a new and single announcement - because all you have to do is save the user list once the time is up, and you'll know who viewed it by that point and who didn't.
Where it gets tricky, is if you edit or add to that announcement - because then the question is who read it since it was updated. It's for that reason that I added that second counter. Now, once you edit or add to an Announcement/Bulletin/Post, just reset the second counter for that thread. Now you'll know exactly who read it before your changes and who read it afterwards. :)
Ocean, can you make it to Who View This Announcement too? wouldnt be too hard, right?
Brandon Sheley
05-25-2005, 05:14 AM
nice hack, installed no probs.. was a little confused with step 6. but after looking thu this thread i got it working fine :)
thank you
*clicks instal*
brvheart
09-08-2005, 12:01 PM
ok, I have 3.0.7
this is the code that I see:
//set thread last view
if ($thread['pollid'] AND $vboptions['updatelastpost'] AND ($displayed_dateline == $thread['lastpost'] OR $threadview == $thread['lastpost']) AND $pollinfo['lastvote'] > $thread['lastpost'])
{
$displayed_dateline = $pollinfo['lastvote'];
}
if ((!$posted OR $updatethreadcookie) AND $displayed_dateline AND $displayed_dateline > $threadview)
{
set_bbarray_cookie('thread_lastview', $threadid, $displayed_dateline);
I am supposed to be looking for this:
// ************************************************** *******************************
//set thread last view
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
I did a search in winsyntax(my editor), and the code $threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
is not found until way down the screen no where close to //set thread last view
so where should I add the this above?
################################################## ##############################
########################## Who Viewed This Thread ##############################
########################## CONFIGURATION ##############################
################################################## ##############################
/*
Any help would be greatly appreciated.
brvheart
09-08-2005, 12:50 PM
ok, let me see if I got this right,
I inset nothing between the "configuration Sections" it is just guidlines, but after that I post everything until the next step?
I think that is where I went wrong, I will try again, please someone chime in here and give me a hand :)
brvheart
09-08-2005, 12:54 PM
well, that did not work either...I will wait on someone to jump in here and give me a hand.
brvheart
09-08-2005, 01:09 PM
I get the DA award!!!! Had I read, and followed, I would have been ok, instead of trying to make my thinking on it.
"ADD EVERYTHING BETWEEN *********** AND ********** MEANS JUST THAT!
Thank you for hack, tested works great!
pirotess
09-14-2005, 03:57 PM
Any chance this can be ported to the plugin system of 3.5? I love this mod and already have the table rows built up from a long period of use so dont want to lose all that functionality.
brvheart
12-24-2005, 04:38 PM
any chance of getting this enhanced version ported to 3.5.x?
brvheart
01-05-2006, 06:59 PM
any chance of getting this enhanced version ported to 3.5.x?
bump :)
Chris583
01-22-2006, 10:09 PM
me too!
cherieann
02-22-2006, 02:39 PM
would love a 3.5 as well if you have it?
realdes@hotmail
03-08-2006, 09:33 PM
i do all the step in a new Version forum .. it is good hack and a nice work ..
but when i do same all step in my forum i have error in sql db
what can i do plez ?
bjs144
03-09-2006, 03:35 PM
Works a treat on 3.0.8. Cracking Mod. Well done
Would like the "User viewed this thread at time & date" info as my small board needs to record when people read the thread.
Many thanks again.
Powlo
03-20-2008, 01:11 AM
I installed as per instructions but when i refresh the thread i have just looked at i get a blank white screen.
I also have this problem..
ok, I have 3.0.7
this is the code that I see:
//set thread last view
if ($thread['pollid'] AND $vboptions['updatelastpost'] AND ($displayed_dateline == $thread['lastpost'] OR $threadview == $thread['lastpost']) AND $pollinfo['lastvote'] > $thread['lastpost'])
{
$displayed_dateline = $pollinfo['lastvote'];
}
if ((!$posted OR $updatethreadcookie) AND $displayed_dateline AND $displayed_dateline > $threadview)
{
set_bbarray_cookie('thread_lastview', $threadid, $displayed_dateline);
I am supposed to be looking for this:
// ************************************************** *******************************
//set thread last view
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
so where should I add the this above?
################################################## ##############################
########################## Who Viewed This Thread ##############################
########################## CONFIGURATION ##############################
################################################## ##############################
/*
Any ideas?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.