Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Who's Viewed This Thread? Details »»
Who's Viewed This Thread?
Version: 1.00, by filburt1 filburt1 is offline
Developer Last Online: May 2007 Show Printable Version Email this Page

Version: 2.3.x Rating:
Released: 05-21-2003 Last Update: Never Installs: 24
 
No support by the author.

This hack lists users who have already viewed the current thread (provided those users weren't invisible when they viewed it).

Show Your Support

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

Comments
  #22  
Old 05-27-2003, 12:34 AM
Mike Gaidin's Avatar
Mike Gaidin Mike Gaidin is offline
 
Join Date: Oct 2001
Location: Michigan
Posts: 247
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'd be interested Boofo.
Reply With Quote
  #23  
Old 05-27-2003, 03:26 AM
ethics ethics is offline
 
Join Date: Feb 2002
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Boofo, you would be a life saver. I've installed that hack but the members went ape#$($ because they didn't want anyone to know if they read the thread. Don't ask, I still don't know why.

Anyway, would love the "fix".
Reply With Quote
  #24  
Old 05-27-2003, 03:29 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

They could just make themselves invisible and they won't be added to any more thread view lists.
Reply With Quote
  #25  
Old 05-27-2003, 03:29 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Yesterday at 09:06 PM Boofo said this in Post #20
I redid this for my site so it only shows to Admins and it will show invisible users, too. I also put it at the bottom in it's own box. If anyone is interested I can attach the file, if filburt doesn't mind, that is.
The changes only would be better (I'm assuming it's only three lines of code, two of which are braces).
Reply With Quote
  #26  
Old 05-27-2003, 03:50 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, here it is. Find:

PHP Code:
// make sure not to have redundancy in the view list, so get who's viewed it
// first (and do nothing for invisible users)
$thisthread $DB_site->query_first("SELECT useridviews FROM thread
    WHERE threadid = 
$threadid");
$useridviews explode(" "$thisthread['useridviews']);
if (!
$bbuserinfo['invisible'])
{
    if (!empty(
$thisthread['useridviews']))
    {
        if (!
in_array($bbuserinfo['userid'], $useridviews))
        {
            
$DB_site->query("
                UPDATE thread
                SET useridviews = CONCAT(useridviews, \" \", \"" 
.
                    
$bbuserinfo['userid'] . "\")
                WHERE threadid = 
$threadid");
        }
    }
    else
    {
        
$DB_site->query("UPDATE thread
            SET useridviews = \"" 
$bbuserinfo['userid'] . "\"
            WHERE threadid = 
$threadid");
    }

Change it to:

PHP Code:
// make sure not to have redundancy in the view list, so get who's viewed it
// first (and do nothing for invisible users)
$thisthread $DB_site->query_first("SELECT useridviews FROM thread
    WHERE threadid = 
$threadid");
$useridviews explode(" "$thisthread['useridviews']);
//if (!$bbuserinfo['invisible'])
//{
    
if (!empty($thisthread['useridviews']))
    {
        if (!
in_array($bbuserinfo['userid'], $useridviews))
        {
            
$DB_site->query("
                UPDATE thread
                SET useridviews = CONCAT(useridviews, \" \", \"" 
.
                    
$bbuserinfo['userid'] . "\")
                WHERE threadid = 
$threadid");
        }
    }
    else
    {
        
$DB_site->query("UPDATE thread
            SET useridviews = \"" 
$bbuserinfo['userid'] . "\"
            WHERE threadid = 
$threadid");
    }
//} 
Find:

PHP Code:
    $thread['viewers'] = implode(", "$viewers);

Change it to:

PHP Code:
    $thread['viewers'] = implode(", "$viewers);
    If (
$bbuserinfo[usergroupid]==OR $bbuserinfo[usergroupid]==5) {
    eval(
"\$totalviewers = \"".gettemplate('showthread_totalviewers')."\";");
   }

Make a new template called "showthread_totalviewers" (and don't forget to include this in the templatesused line in the showthread.php)

PHP Code:
<table cellpadding="0" cellspacing="0" border="0" bgcolor="{ tablebordercolor}"  width="100%" align="center"><tr><td>
<
table cellpadding="4" cellspacing="1" border="0"  width="100%">
<
tr id="cat">
        <
td bgcolor="{ tableheadbgcolor}" nowrap><normalfont><b>Already viewed: <i>$thread[title]</i></b></normalfont></td>
</
tr>
<
tr>
        <
td bgcolor="{ firstaltcolor}" align="center" nowrap>
<
table cellpadding="4" cellspacing="0" border="0" width="100%">
<
tr>
        <
td><smallfont><b>$thread[viewers]</smallfont></td>
</
tr>
</
table>
</
td></tr></table>
</
td></tr></table>
<
br /> 
Take the spaces out after the { in the code

and put "$totalviewers" wherever you want it to show up in the showthread template (I put it at the bottom).
Reply With Quote
  #27  
Old 05-27-2003, 01:52 PM
MetroSports82's Avatar
MetroSports82 MetroSports82 is offline
 
Join Date: Nov 2002
Location: NJ
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice work. Thank you, sir.

Here's the only other problem that I'm expirencing. For whatever reason, it seems to not log the usernames, other than the ones that are able to view the list (in this case usergroups 5 and 6), unless I add additional usergroups, then it comes up working fine. here is the code that i have.

PHP Code:
if ($bbuserinfo[usergroupid]==OR $bbuserinfo[usergroupid]==
OR $bbuserinfo[usergroupid]==OR $bbuserinfo[usergroupid]==OR $bbuserinfo[usergroupid]==
OR $bbuserinfo[usergroupid]==13 OR $bbuserinfo[usergroupid]==16 OR $bbuserinfo[usergroupid]==14 
OR $bbuserinfo[usergroupid]==18 OR $bbuserinfo[usergroupid]==12 OR $bbuserinfo[usergroupid]==17 
OR $bbuserinfo[usergroupid]==15 OR $bbuserinfo[usergroupid]==OR $bbuserinfo[usergroupid]==
OR $bbuserinfo[usergroupid]==3) {
// make sure not to have redundancy in the view list, so get who's viewed it
// first (and do nothing for invisible users)
$thisthread $DB_site->query_first("SELECT useridviews FROM thread
    WHERE threadid = 
$threadid");
$useridviews explode(" "$thisthread['useridviews']);
//if (!$bbuserinfo['invisible'])
//{
    
if (!empty($thisthread['useridviews']))
    {
        if (!
in_array($bbuserinfo['userid'], $useridviews))
        {
            
$DB_site->query("
                UPDATE thread
                SET useridviews = CONCAT(useridviews, \" \", \"" 
.
                    
$bbuserinfo['userid'] . "\")
                WHERE threadid = 
$threadid");
        }
    }
    else
    {
        
$DB_site->query("UPDATE thread
            SET useridviews = \"" 
$bbuserinfo['userid'] . "\"
            WHERE threadid = 
$threadid");
    }
//}

// now...who's viewed this thread? (will include $bbuserinfo if he's not invis)
if (empty($thisthread['useridviews']))
{
    
$thread['viewers'] = "nobody";
}
else
{
    
$result $DB_site->query("SELECT userid, username FROM user
        WHERE userid IN (" 
implode(", "$useridviews) . ")");
    
$viewers = array();
    while (
$user $DB_site->fetch_array($result))
    {
        
array_push($viewers"<a target=\"_blank\" href=\"member.php?s=" .
            
$session['sessionhash'] . "&action=getinfo&userid=" .
            
$user['userid'] . "\">" htmlspecialchars($user['username']) .
            
"</a>");
    }
    
$thread['viewers'] = implode(", "$viewers);
    eval(
"\$totalviewers = \"".gettemplate('showthread_totalviewers')."\";");
   }

how would i go about to only have these show up for admins, while having it log every user, w/o having to add all those additonal usergroups? thanks again filburt1 and boofo!
Reply With Quote
  #28  
Old 05-27-2003, 04:13 PM
Kmaster Kmaster is offline
 
Join Date: Mar 2002
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

possible to make only show on Admins and thread creator, other ppl will still not viewtable. tks
Reply With Quote
  #29  
Old 05-27-2003, 04:24 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

MetroSports82, sorry about that. Thanks for catching it. If you'll redo the code I posted above, it should now work fine. I had the bbuserinfo[usergroupid] in the wrong place. I edited my post above to put it right before it evals the template. I tested it and it seems to fix your problem. All usergroups will be tallied now and only the usergroups you want to see the listing will be able to see it.
Reply With Quote
  #30  
Old 05-27-2003, 04:26 PM
MetroSports82's Avatar
MetroSports82 MetroSports82 is offline
 
Join Date: Nov 2002
Location: NJ
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hehe, nevermind boofo! just saw your edit on your original post where ya adding the usergroups line, right above the evals template line, and it works just fine now! thanks again m8.

PHP Code:
// make sure not to have redundancy in the view list, so get who's viewed it
// first (and do nothing for invisible users)
$thisthread $DB_site->query_first("SELECT useridviews FROM thread
    WHERE threadid = 
$threadid");
$useridviews explode(" "$thisthread['useridviews']);
//if (!$bbuserinfo['invisible'])
//{
    
if (!empty($thisthread['useridviews']))
    {
        if (!
in_array($bbuserinfo['userid'], $useridviews))
        {
            
$DB_site->query("
                UPDATE thread
                SET useridviews = CONCAT(useridviews, \" \", \"" 
.
                    
$bbuserinfo['userid'] . "\")
                WHERE threadid = 
$threadid");
        }
    }
    else
    {
        
$DB_site->query("UPDATE thread
            SET useridviews = \"" 
$bbuserinfo['userid'] . "\"
            WHERE threadid = 
$threadid");
    }
//}

// now...who's viewed this thread? (will include $bbuserinfo if he's not invis)
if (empty($thisthread['useridviews']))
{
    
$thread['viewers'] = "nobody";
}
else
{
    
$result $DB_site->query("SELECT userid, username FROM user
        WHERE userid IN (" 
implode(", "$useridviews) . ")");
    
$viewers = array();
    while (
$user $DB_site->fetch_array($result))
    {
        
array_push($viewers"<a target=\"_blank\" href=\"member.php?s=" .
            
$session['sessionhash'] . "&action=getinfo&userid=" .
            
$user['userid'] . "\">" htmlspecialchars($user['username']) .
            
"</a>");
    }
    
$thread['viewers'] = implode(", "$viewers);
if (
$bbuserinfo[usergroupid]==6) {
    eval(
"\$totalviewers = \"".gettemplate('showthread_totalviewers')."\";");
   }

Metro.
Reply With Quote
  #31  
Old 05-27-2003, 04:39 PM
ethics ethics is offline
 
Join Date: Feb 2002
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Boofo (and others--especially the original hack maker).
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 03:41 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.04634 seconds
  • Memory Usage 2,378KB
  • 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
  • (7)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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