vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Who's Viewed This Thread? (https://vborg.vbsupport.ru/showthread.php?t=53250)

filburt1 05-21-2003 10:00 PM

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

filburt1 05-22-2003 08:54 PM

Screenshot:

all-the-vb 05-22-2003 09:02 PM

:laugh: nice hack

*All-the-vb clicks install

MetroSports82 05-22-2003 10:11 PM

nice addition m8. is there any way to have this act as a pop-up? ;)

FFArmageddon 05-22-2003 10:22 PM

can you make it so that the numbers in the "view" colum in forumsdisplay is clickable like the numbers in the "post" colum?

filburt1 05-22-2003 10:26 PM

No offense, but I generally don't add functionality to hacks after I release them; only support (unofficially) the original and fix bugs.

Boofo 05-23-2003 02:02 AM

Is there a way to separate this listing off who viewed and who is viewing now? And can we have the invisible users at least show up for the Admin?

filburt1 05-23-2003 02:03 AM

Explain. :)

Boofo 05-23-2003 02:04 AM

Like the users browsing now would be a separate list from the users that have viewed in the past.

Austin Dea 05-23-2003 02:14 AM

They would be if you installed Firefly's Thread Browser Hack..

Boofo 05-23-2003 02:20 AM

I have that installed. ;)

MetroSports82 05-23-2003 02:52 AM

is there a way to have the invisible users show up? ;)

Shepski 05-23-2003 08:36 AM

I have installed this great hack but have a couple of questions:

1.) In the text file you have:
Code:

3. In showthread, find:

$poll

Before that, add:

<smallfont>Already viewed or currently viewing this thread:</b> $thread[viewers]</smallfont><br>

Should this be in Showthread Template as I cant find $poll in showthread? I have stuck it inthe template anyway.

2.) Edit: Sorted, me being a dummy :(

thanks

iggy123 05-23-2003 08:44 AM

nice hack thnx --- see not everyone asks for something. ;)

bloodcult 05-23-2003 01:52 PM

thx filburt to write this pice of code :)

Dean C 05-23-2003 05:58 PM

This is a superb idea arien :)

- miSt

djr 05-23-2003 10:06 PM

I need this for one specific forum .. as you stated you won't add functionality, but is there's somebody else who's willing to help me out?

Intex 05-24-2003 10:39 AM

This is a really cool idea. But with forums with lots of members viewing the threads, I would have thought the list of people that have viewed the thread could get out of control.

Just a suggestion, but maybe it would be better to have a . . . more after x amount of listed users, or even better a popup window that shows you just like the 'who voted' hack.

Nevertheless v. nice work :).

ethics 05-27-2003 12:01 AM

Anyone know how only admins would be able to see this?

Boofo 05-27-2003 12:06 AM

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.

Mike Gaidin 05-27-2003 12:34 AM

I'd be interested Boofo. :)

ethics 05-27-2003 03:26 AM

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".

filburt1 05-27-2003 03:29 AM

They could just make themselves invisible and they won't be added to any more thread view lists.

filburt1 05-27-2003 03:29 AM

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).

Boofo 05-27-2003 03:50 AM

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).

MetroSports82 05-27-2003 01:52 PM

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! ;)

Kmaster 05-27-2003 04:13 PM

possible to make only show on Admins and thread creator, other ppl will still not viewtable. tks

Boofo 05-27-2003 04:24 PM

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.

MetroSports82 05-27-2003 04:26 PM

hehe, nevermind boofo! :D 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.

ethics 05-27-2003 04:39 PM

Thanks Boofo (and others--especially the original hack maker). :)

MetroSports82 05-27-2003 04:47 PM

btw, just notice one other small issue with the template, especially when you start getting alot users who come up listed as viewed, as it doesn't wrap the text, especially for people on a 800x600 display. anyway, if you just take out the word 'no', in the word 'nowrap' it'll just wrap the usernames text, from top to bottom, rather than having it run on from left to right. thanks again! ;)

PHP Code:

<td nowrap><smallfont><b>$thread[viewers]</smallfont></td

to

PHP Code:

<td><smallfont><b>$thread[viewers]</smallfont></td


Boofo 05-27-2003 05:20 PM

Instead of <td wrap> just make it <td> then.

legendarysk8er 06-05-2003 02:12 AM

Nice hack, but it would be nice if you included in the first post what had to be modified and added.

squawell 06-05-2003 04:13 AM

how to change the code to let admin and thread starter can see

who viewed the topic??

Intex 06-16-2003 08:01 PM

Filburt1 - nice hack. Boofo - nice modifications which I've implemented :cool:.

How many queries does this add to the page page if I've used Boofo's modification where only the admin's can view the people who have viewed the thread?

[high]* Intex clicks install.[/high]

Boofo 06-17-2003 01:36 AM

Quote:

Today at 04:01 PM Intex said this in Post #35
Filburt1 - nice hack. Boofo - nice modifications which I've implemented :cool:.

How many queries does this add to the page page if I've used Boofo's modification where only the admin's can view the people who have viewed the thread?

* Intex clicks install.

As long as you add the showthread_totalviewers template to the templatesused line in the showthread.php, the queries would be the same with or without the modification.

Intex 06-17-2003 09:41 AM

Hmm, that's what I thought. OK, thanks.


All times are GMT. The time now is 02:00 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01420 seconds
  • Memory Usage 1,888KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (9)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (37)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete