Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

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
  #32  
Old 03-31-2004, 06:48 AM
Carter876's Avatar
Carter876 Carter876 is offline
 
Join Date: Mar 2004
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Carter876
Hi Gery W, I like very much this hack but I have a questions:
Is there the possibility that onlyAdmins see this "Who viewed this thread" Panel (if Yes, How?)

Tnx and compliments for the nice hack

Regards
Gery can you answer to my question, pls?

Tnx
Reply With Quote
  #33  
Old 03-31-2004, 09:56 AM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Carter876
Gery can you answer to my question, pls?

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

Code:
 
<if condition="is_member_of($bbuserinfo,6)">
 
<!-- Inserted code goes here -->
 
</if>
 



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


Reply With Quote
  #34  
Old 03-31-2004, 12:21 PM
VitroX VitroX is offline
 
Join Date: Feb 2004
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a wonderfull hack, thanks for making.

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

Thanks again.
Reply With Quote
  #35  
Old 03-31-2004, 08:40 PM
Carter876's Avatar
Carter876 Carter876 is offline
 
Join Date: Mar 2004
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Code:
 
<if condition="is_member_of($bbuserinfo,6)">
 
<!-- Inserted code goes here -->
 
</if>
 



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


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

Someone can help me, pls?

Regards
Reply With Quote
  #36  
Old 04-01-2004, 07:32 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Gary W
All 3 are fixed The invisible users part, it shows invisible users to all users to have less strain on the servers.
Hi, Gary! I finally got the chance to install the revised version. And although the problem with the Invisible Users and the Title Bar are fixed (thanks!), the third problem remains. Clicking on a Username still opens up the Profile in a new window, rather than the same one.


p.s. I'm still interested in knowing what I would need to change, if I wanted Invisible Users handled the same way it is on the Forum Home. (i.e. Only shown to those with access to see Invisible Users, suffixed with the "*" character, etc...)
Reply With Quote
  #37  
Old 04-01-2004, 07:37 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Someone can help me, pls?

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

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

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


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

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

</if>
Also, remember that although I stated that Group-ID 6 should be the default for Admins - that doesn't mean that it's not possible for that to have changed on your system. It's worth double checking both that, as well as the syntax.
Reply With Quote
  #38  
Old 04-01-2004, 08:37 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


p.s. I'm still interested in knowing what I would need to change, if I wanted Invisible Users handled the same way it is on the Forum Home. (i.e. Only shown to those with access to see Invisible Users, suffixed with the "*" character, etc...)
To open in same window, remove target="_blank"
Reply With Quote
  #39  
Old 04-01-2004, 09:04 PM
Carter876's Avatar
Carter876 Carter876 is offline
 
Join Date: Mar 2004
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ocean
Carter876, the code does the job perfectly. I just tried it myself. Are you sure you implemented it correctly?

The code needs to be inserted into the ShowThread **Template** (NOT Showthread.php). If you put it into ShowThread.php, that would account for the Parse Error.
Ops you are right , it now works perfectly :up: Tnx

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

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

Tnx for the help!

Regards
Reply With Quote
  #40  
Old 04-02-2004, 12:04 AM
Isotope Isotope is offline
 
Join Date: Mar 2004
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What needs to be changed in the code, if I want this bar to be Collapsed by default, rather than expanded?
Reply With Quote
  #41  
Old 04-03-2004, 11:07 PM
pcalloway pcalloway is offline
 
Join Date: Dec 2003
Location: Indiana
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My table heading is showing as blank rather then stating:

"Already viewed this thread:"

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


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 02:27 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.05093 seconds
  • Memory Usage 2,343KB
  • 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
  • (3)bbcode_code
  • (2)bbcode_html
  • (2)bbcode_php
  • (7)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