vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Show Thread Enhancements - Who viewed this thread? (https://vborg.vbsupport.ru/showthread.php?t=61222)

Gary King 02-05-2004 10:00 PM

Who viewed this thread?
 
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 :D

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

Omega Prime 02-06-2004 12:32 PM

oooh! Thanks for making this hack so fast :D !

Xenon 02-06-2004 01:10 PM

you should rename that php file into .txt ;)

mashour.net 02-06-2004 01:20 PM

Thanks :rolleyes:

sabret00the 02-06-2004 03:18 PM

not bad, not bad at all, would be great as a store action :)

Gary King 02-06-2004 07:22 PM

Quote:

Originally Posted by Xenon
you should rename that php file into .txt ;)

I did it real quick and my default file format is PHP :p
Fixing now :)

Gary King 02-06-2004 07:23 PM

Quote:

Originally Posted by sabret00the
not bad, not bad at all, would be great as a store action :)

You mean for the Store hack?

sabret00the 02-06-2004 08:26 PM

yup theirs no vb3 version yet, but it would be awesome, to buy the power to see who's viewed threads :)

WAR 02-08-2004 01:14 AM

Is this Hack HTL compliant?

I noticed that the changes file was .htl but you didn't really indicate that it was anywhere else in this thread...

Gary King 02-08-2004 01:56 AM

Quote:

Originally Posted by WAR
Is this Hack HTL compliant?

I noticed that the changes file was .htl but you didn't really indicate that it was anywhere else in this thread...

There hopefully a bit more clear ;)

StarBuG 02-08-2004 08:07 AM

Hi

I have one question.
What about if a thread was viewed by let´s say 150 members do I see the whole list of 150 members above the thread then?

Wouldn´t it be better to have the who viewed as a link wich opens a popup list.

Greetings

Star

Gary King 02-08-2004 01:05 PM

Quote:

Originally Posted by StarBuG
Hi

I have one question.
What about if a thread was viewed by let?s say 150 members do I see the whole list of 150 members above the thread then?

Wouldn?t it be better to have the who viewed as a link wich opens a popup list.

Greetings

Star

Well technically that's how WOL works as well, so this is like that. If there are lots of people, then yes it will show the whole list, but it's not like every thread will be like that (hopefully) :D If there are lots of people who want this feature added then I could do that.

rms10 02-11-2004 03:45 PM

Quote:

If there are lots of people who want this feature added then I could do that.
I would like this feature added :)

rms10 02-11-2004 04:41 PM

BTW trying to use the htl file to install the hack on RC4 and get the following error:

No Phrases file found in Hack data or file system!
No groupname specified.

running the verbose test it showed this info:

This step would import a new set of phrases for the Hack

It would create this new column on the language table:
phrasegroup_

It would take the new phrases from this file:
./htlfiles/whoviewed_phrases

Xenon 02-11-2004 06:36 PM

Quote:

Originally Posted by Gary W
Well technically that's how WOL works as well, so this is like that. If there are lots of people, then yes it will show the whole list, but it's not like every thread will be like that (hopefully) :D If there are lots of people who want this feature added then I could do that.

may i suggest another method?

just put it into a collapsable table, that way it wouldn't fill up to much space if not wanted ;)

Gary King 02-11-2004 07:42 PM

Quote:

Originally Posted by Xenon
may i suggest another method?

just put it into a collapsable table, that way it wouldn't fill up to much space if not wanted ;)

Yeah I know that was my alternative.

Gary King 02-11-2004 08:26 PM

Collapsable table added :)

Gary King 02-11-2004 08:28 PM

Fancy screenshot added as well :p

Xenon 02-11-2004 08:54 PM

*gg* nice screeny

Gary King 02-11-2004 09:12 PM

Quote:

Originally Posted by Xenon
*gg* nice screeny

Thanks :D

Alas-Digitales 02-12-2004 09:49 PM

Is it possible to show this option also to super-moderatos? I have tried to insert it this way:

HTML Code:

<if condition="$+++++ad and $bbuserinfo[usergroupid]==5 and $bbuserinfo[usergroupid]==6">
But it does no work. How can I do it?

Gary King 02-12-2004 09:58 PM

Quote:

Originally Posted by Alas-Digitales
Is it possible to show this option also to super-moderatos? I have tried to insert it this way:

HTML Code:

<if condition="$+++++ad and $bbuserinfo[usergroupid]==5 and $bbuserinfo[usergroupid]==6">
But it does no work. How can I do it?

Use 'or' instead of 'and'.

Alas-Digitales 02-12-2004 10:06 PM

Thanks!!!

Ocean 03-29-2004 12:13 PM

Hi, Gary!


Quick question - is this hack fully stable and compatible with vB 3.0 Gold? Or does it need to be updated?

Gary King 03-29-2004 07:04 PM

Quote:

Originally Posted by Ocean
Hi, Gary!


Quick question - is this hack fully stable and compatible with vB 3.0 Gold? Or does it need to be updated?

Yes it should work with Gold.

Ocean 03-29-2004 07:34 PM

Great!

Thanks again!

Carter876 03-30-2004 09:38 AM

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

Ocean 03-30-2004 12:07 PM

Hi, Gary! I just installed this hack, but I'm having three issues with it:


1. Invisible Users don't show up at all. I would have thought that this would work like vB's Currently Active Users, or even like your Who Was Online Today - where Invisible Users appear to those who have the rights to see them (and they are suffixed with a " * " character. But in this case, they are just not there.

2. The Title Bar doesn't actually reach all the way to the right side. If you collapse it, then it displays properly. But while expanded, it falls a quarter inch short.

3. On your Who Was Online Today hack, when you click on a Username, it brings up the profile in the same window. But on this one, it opens a new window. Is this easily fixable?


Now the only question is - did I do something wrong? Or are these three issues actually bugs? :)

Gary King 03-30-2004 11:11 PM

Quote:

Originally Posted by Ocean
Hi, Gary! I just installed this hack, but I'm having three issues with it:


1. Invisible Users don't show up at all. I would have thought that this would work like vB's Currently Active Users, or even like your Who Was Online Today - where Invisible Users appear to those who have the rights to see them (and they are suffixed with a " * " character. But in this case, they are just not there.

2. The Title Bar doesn't actually reach all the way to the right side. If you collapse it, then it displays properly. But while expanded, it falls a quarter inch short.

3. On your Who Was Online Today hack, when you click on a Username, it brings up the profile in the same window. But on this one, it opens a new window. Is this easily fixable?


Now the only question is - did I do something wrong? Or are these three issues actually bugs? :)

All 3 are fixed :) The invisible users part, it shows invisible users to all users to have less strain on the servers.

Ocean 03-30-2004 11:28 PM

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.

Great! I'll give it a shot tomorrow and see how it goes.


Incidentally, I only plan on certain users being able to access this feature - so I wouldn't think it would be that great a strain on the Server, for me at least.

What would I 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...)

:)

Carter876 03-31-2004 06:48 AM

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

Ocean 03-31-2004 09:56 AM

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



VitroX 03-31-2004 12:21 PM

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.

Carter876 03-31-2004 08:40 PM

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

Ocean 04-01-2004 07:32 PM

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

Ocean 04-01-2004 07:37 PM

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.

Gary King 04-01-2004 08:37 PM

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"

Carter876 04-01-2004 09:04 PM

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 :D

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

Isotope 04-02-2004 12:04 AM

What needs to be changed in the code, if I want this bar to be Collapsed by default, rather than expanded?

pcalloway 04-03-2004 11:07 PM

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?


All times are GMT. The time now is 01:00 AM.

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.04196 seconds
  • Memory Usage 1,870KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_html_printable
  • (2)bbcode_php_printable
  • (19)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete