Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard

Reply
 
Thread Tools
Who viewed this thread? Details »»
Who viewed this thread?
Version: 1.00, by Gary King Gary King is offline
Developer Last Online: Jun 2020 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 3.0.0 Rating:
Released: 02-05-2004 Last Update: Never Installs: 50
 
No support by the author.

There is an enhanced version of this mod found here.

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

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

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

View the screenshot to see the hack in action

Instructions

FILES
------
showthread.php

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

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

ADD PHRASE:
already_viewed_this_thread / Already viewed this thread:


OPEN FILE showthread.php AND FIND


PHP Code:
// *********************************************************************************
//set thread last view
set_bbarray_cookie('thread_lastview'$threadidTIMENOW); 

ABOVE ADD


PHP Code:
$showinvisible 1;

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

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

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

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


OPEN SHOWTHREAD TEMPLATE AND FIND

HTML Code:
$poll
ABOVE ADD

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #72  
Old 05-29-2004, 05:54 PM
weaver weaver is offline
 
Join Date: Mar 2004
Posts: 183
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by snobbymom
I'm interested in this as well... or some way of telling when was the most recent time they viewed the thread.
I'm still interested in this if anyone has figured out how to do it. I'd like to be able to pinpoint if a member has read a post after additional information was posted for them. Right now I can only determine if they read the post at all. Thanks.
Reply With Quote
  #73  
Old 06-02-2004, 01:53 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a really great idea for a way to improve this hack.


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


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


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




Method 1


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

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

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

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


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

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



Method 2


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

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


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


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

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




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


Gary, do you like this idea? Is either Method practically doable?
Reply With Quote
  #74  
Old 06-02-2004, 01:57 PM
Intex Intex is offline
 
Join Date: Apr 2002
Posts: 576
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Option 1 is probably more work than option 2. The timestamp from my perspective would be the one to go for. It would be great if someone could implement this change.
Reply With Quote
  #75  
Old 06-02-2004, 02:26 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Option 1 is probably more work than option 2. The timestamp from my perspective would be the one to go for. It would be great if someone could implement this change.
The original version of this hack only adds one Field ("whoviewed") to the "threads" table. It stores a list of UserIDs, and that's it.

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


If we go with Method 2, some way needs to be found to efficiently store a date/timestamp with each UserID for each thread. To my mind, that makes Method 2 more complicated to implement - although I agree that it would be the more useful option.
Reply With Quote
  #76  
Old 07-01-2004, 06:08 AM
FWF FWF is offline
 
Join Date: Feb 2003
Location: Indianapolis, IN
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this should be updated for 3.0.1
Reply With Quote
  #77  
Old 07-05-2004, 03:06 AM
FWF FWF is offline
 
Join Date: Feb 2003
Location: Indianapolis, IN
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no update i take it ?
Reply With Quote
  #78  
Old 07-06-2004, 05:27 PM
Rocol Rocol is offline
 
Join Date: Jul 2003
Location: UK
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this hack be udated to work on vB3.0.3 please ... thanks in advance guys, keep up the excellent work
Reply With Quote
  #79  
Old 07-06-2004, 07:21 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rocol

Will this hack be udated to work on vB3.0.3 please ... thanks in advance guys, keep up the excellent work
I have this working on a 3.0.3 installation. Is there a reason why you think that it needs to be updated for 3.0.3?
Reply With Quote
  #80  
Old 07-06-2004, 08:36 PM
mtha's Avatar
mtha mtha is offline
 
Join Date: Jul 2002
Location: US
Posts: 775
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ocean
I have this working on a 3.0.3 installation. Is there a reason why you think that it needs to be updated for 3.0.3?
because the hack said to work with version 3.0.0, and some people dont want to give it a shoot in other versions.

update would be adding a line, saying it works with ... some versions
Reply With Quote
  #81  
Old 07-07-2004, 07:24 AM
Rocol Rocol is offline
 
Join Date: Jul 2003
Location: UK
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@ Ocean .. thanks for the reply, after reading that it worked for you, I checked again .. it was my bad application of the hack .. when copying I had missed off the last } .. all working fine now .. thanks
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05023 seconds
  • Memory Usage 2,326KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_html
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete