vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Who viewed this thread? (https://vborg.vbsupport.ru/showthread.php?t=91409)

Johannes de Le?n 06-29-2005 10:00 PM

Who viewed this thread?
 
This is a port of: https://vborg.vbsupport.ru/showthread.php?t=61222
(ported with permission)

Who viewed this thread?
This hack shows who has viewed any thread. View the screenshot to see how it looks.

Details
1 Query
1 New Phrase
1 Template Edit
1 Plugin XML

Screenshots
Available here, though now the box appears below the Current Active Users instead of above the post reply button, and it is not collapsible anymore.

Credits
Gary King, for allowing me to port his hack.

-----------

Instructions

Run query [sql]ALTER TABLE thread ADD whoviewed TEXT NOT NULL;[/sql]

Create new phrase
already_viewed_this_thread / Already viewed this thread:

Edit template
Open SHOWTHREAD and find:
HTML Code:

<!-- currently active users -->
<if condition="$show['activeusers']">
        <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
        <tr>
                <td class="tcat" colspan="2">
                        <phrase 1="$totalonline" 2="$numberregistered" 3="$numberguest">$vbphrase[users_viewing_this_thread_x_y_z]</phrase>
                </td>
        </tr>
        <tr>
                <td class="alt1" colspan="2">
                        <span class="smallfont">$activeusers</span>
                </td>
        </tr>
        </table>
</if>
<!-- currently active users -->

Below this add:
HTML Code:

<!-- who viewed this thread -->
        <br />
        <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
        <tr>
                <td class="tcat" colspan="2">
                        $vbphrase[already_viewed_this_thread]
                </td>
        </tr>
        <tr>
                <td class="alt1" colspan="2">
                        <span class="smallfont">$thread[viewers]</span>
                </td>
        </tr>
        </table>
<!-- who viewed this thread -->

Plugin
Just upload it, and it's all done.

Options
If you want to have invisible users in the list, go to the plugin manager, click edit to edit this plugin then add this to the beginning:
HTML Code:

$showinvisible = 1;

.Tim 06-30-2005 09:04 PM

Thanks! Great hack, been waiting for this one a while. Will have a lot of happy users now.
Is there anyway to add the time read to this?

Like it is in this one:

https://vborg.vbsupport.ru/showthread.php?t=61225

Johannes de Le?n 06-30-2005 09:58 PM

Quote:

Originally Posted by .Tim
Thanks! Great hack, been waiting for this one a while. Will have a lot of happy users now.
Is there anyway to add the time read to this?

Like it is in this one:

https://vborg.vbsupport.ru/showthread.php?t=61225

I'll see what I can do. :)

Chris M 06-30-2005 10:11 PM

While this is a nice idea, I have to worry about the performance issues associated with this on a large board - Potentially every user could have viewed it, and with a large board which is active the likelyhood of causing performance issues is greatly increased :ermm:

Satan

Loki12 07-01-2005 11:09 AM

Excellent Johannes! I will install when I get home tonight ... :D

welo 08-12-2005 08:41 AM

Quote:

Originally Posted by hellsatan
While this is a nice idea, I have to worry about the performance issues associated with this on a large board - Potentially every user could have viewed it, and with a large board which is active the likelyhood of causing performance issues is greatly increased

This will create a performance hit if you allow everyone access to it (especially guests). However, you can restrict the usergroups who can see the "who viewed" box (thus eliminating uneccessary queries) by wrapping all the injected template code in an <if> statement:

Code:

<if condition="in_array($bbuserinfo['usergroupid'], array( 5, 6, 7))">
<!-- who viewed this thread code-->
</if>

...will restrict viewing only to admins and mods. Add other usergroups at your discretion.

Installed, and thanks. :up:

Marco van Herwaarden 08-12-2005 10:35 AM

Quote:

Originally Posted by welo
This will create a performance hit if you allow everyone access to it (especially guests). However, you can restrict the usergroups who can see the "who viewed" box (thus eliminating uneccessary queries) by wrapping all the injected template code in an <if> statement:

Putting a condition in the template will not stop queries from being executed. Limiting guests, will not have any influence on performance.

welo 08-12-2005 11:31 AM

Okay, replies like that, especially from a moderator, just irk the hell out of me. If you're going to slap down my solution you'd better have one handy that works, or at least tell me why mine won't. If a template condition doesn't render then no query is executed. If you prove me wrong I'll gladly apologize.

Marco van Herwaarden 08-12-2005 11:54 AM

Simple, this is in general how things work (and don't see it as slapping down, just don't always have the time to give a more extended asnwer):
- PHP Script is run
- Logic of the script is followed
- Script will retrieve all needed information from the database and place the information in variables.
- Once all info is available, the script will evaluate a template, in which the variables get replaced by their values.

As you see a condition placed in a template, only effect what is displayed, not what is retrieved from the database.

I can't give you an alternative solution, because i never even looked into this hack. But if you want to improve performance by excluding guests, you will have to edit the PHP-script to make that it will not query the database if a guest is viewing.

Wordplay 08-18-2005 08:36 PM

just showing my appriciation for the hack, installed! thank you for making it.

poolking 08-19-2005 04:57 AM

Quote:

Originally Posted by welo
Okay, replies like that, especially from a moderator, just irk the hell out of me. If you're going to slap down my solution you'd better have one handy that works, or at least tell me why mine won't. If a template condition doesn't render then no query is executed. If you prove me wrong I'll gladly apologize.

Sorry to drag this up but I don't find anything wrong with his initial response. :ermm:

welo 08-19-2005 05:08 AM

Then quit dragging it up. Marco, thanks for clarifying.

mrsbuzzy 09-02-2005 01:14 AM

Hi just wondering if there was any resolution as to a way to get the time viewed next to the name?

.Tim 09-02-2005 01:28 AM

Quote:

Originally Posted by mrsbuzzy
Hi just wondering if there was any resolution as to a way to get the time viewed next to the name?

Yeah, I'd really like it if we could have that feature. :D

poolking 09-02-2005 04:26 AM

Could you tell me whats the point in having the time next to the members name?

mrsbuzzy 09-02-2005 11:08 AM

I have moderators who are expected to respond to threads on their forum. If I see that one has read it hours ago but not replied I take note, if that happens repeatedly I talk with the moderator to see if the subject they host is over their head. I run a medical support site.

Bhuwan 09-22-2005 12:00 AM

any way to make it count the # who've viewd it ?

Bhuwan 09-25-2005 12:52 PM

Could you please add the text markup for a user name??? pretty please

KidneyBoy 09-29-2005 05:05 PM

I'm trying to use it on the final version, but it's not working. Is it just me that's having this problem? After visiting the page a 2nd time, I get an error message, and can't view the post. But when I remove the plug, I can visit the post.

ToastBusters 10-02-2005 07:01 PM

I'm having a problem with it on gold as well. Methinks it isn't compatible.

mrsbuzzy 10-02-2005 07:19 PM

I'm using it on 3.5.0 Release Candidate 2 without any problems.

.Tim 10-02-2005 07:31 PM

Quote:

Originally Posted by ToastBusters
I'm having a problem with it on gold as well. Methinks it isn't compatible.

Works just fine for me.

KidneyBoy 10-02-2005 07:59 PM

Yeah, but unless you have updated your site, you are showing that you are using RC3. It's not working under GOLD--At least not for me. It gives me an error when I re-visit the post (the first time I visit the post, it's fine, but the 2nd time, it's not)

.Tim 10-02-2005 08:55 PM

Quote:

Originally Posted by KidneyBoy
Yeah, but unless you have updated your site, you are showing that you are using RC3. It's not working under GOLD--At least not for me. It gives me an error when I re-visit the post (the first time I visit the post, it's fine, but the 2nd time, it's not)

Oh yeah, my profile is wrong. I'm using gold on my site.

vibe 10-09-2005 07:38 AM

installed

Markco 10-10-2005 04:48 AM

Quote:

Originally Posted by KidneyBoy
I'm trying to use it on the final version, but it's not working. Is it just me that's having this problem? After visiting the page a 2nd time, I get an error message, and can't view the post. But when I remove the plug, I can visit the post.

Yes i have similar probl?me the error is:
Quote:

Fatal error: Cannot use object of type vB_Session as array in /showthread.php(1903) : eval()'d code on line 33

vktechnology 10-11-2005 07:11 AM

doesn't work for me on = vb 3.5 Gold
I've got blank page when click on showthread

GrendelKhan{TSU 10-11-2005 07:21 AM

thanks!!

/me installs (vb 3.5.0 Gold)

microzott 10-12-2005 06:21 AM

installed on Vb 3.5.0 Gold with no problems, but i still have VB3.0.9 on line... :)
the only change i would like to suggest is to includte the day and time of the last viewed (another hack for 3.0.X had it).
do you think is possible?

thanks

.Tim 10-12-2005 09:20 PM

Yes, I agree, the date and time would be great to have.

Rocol 10-17-2005 12:26 PM

Is there any way that the names of those that have viewed the thread, can be placed at the top of the thread, rather than at the bottom please ;)

TMM-TT 10-18-2005 01:54 PM

Quote:

Originally Posted by poolking
Could you tell me whats the point in having the time next to the members name?


I've noticed that this function does'nt work with the gold version. But the problem seem to be easy resolved. :)

In the plugin php code, change this line (sessions):

PHP Code:

            array_push($viewers"<a target=\"_blank\" href=\"member.php?".$vbulletin->session['sessionurl'] . "u=".$user['userid'] . "\">" htmlspecialchars($user['username']) .    "</a>");
    } 


to this line:

PHP Code:


            array_push
($viewers"<a target=\"_blank\" href=\"member.php?".$vbulletin->session->vars['sessionurl'] . "u=".$user['userid'] . "\">" htmlspecialchars($user['username']) .    "</a>");
    } 


.. then it works again. :)

mrsbuzzy 10-18-2005 02:47 PM

Is this to allow the hack to work in gold, or does it add the time stamp?

Quote:

Originally Posted by TMM-TT
I've noticed that this function does'nt work with the gold version. But the problem seem to be easy resolved. :)

In the plugin php code, change this line (sessions):

PHP Code:

            array_push($viewers"<a target=\"_blank\" href=\"member.php?".$vbulletin->session['sessionurl'] . "u=".$user['userid'] . "\">" htmlspecialchars($user['username']) .    "</a>");
    } 


to this line:

PHP Code:


            array_push
($viewers"<a target=\"_blank\" href=\"member.php?".$vbulletin->session->vars['sessionurl'] . "u=".$user['userid'] . "\">" htmlspecialchars($user['username']) .    "</a>");
    } 


.. then it works again. :)


Mastar 10-19-2005 02:56 AM

Like a charm and Clicked install!!

cmiller1014 10-23-2005 01:57 AM

This is EXACTLY what I need guys! Quick question....

Will it work with 3.5 gold, and what code would I wrap around it to show it ONLY to a certain usergroup, and ONLY in a certain forum.

Basically I only want this to show up for my advertisers, and only in the advertising forum so they can see who viewed their ads.

Thanks a ton!

klaush 10-24-2005 06:18 PM

Any idea? Using 3.5 gold:

parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /srv/www/xxx/xxx/vbulletin/showthread.php(1903) : eval()'d code on line 34

Thanks for your help!

steadicamop 11-18-2005 04:58 PM

Installed fine on 3.5.1 - no problems quick install and works well, although doesn't show usergroup types (red = admin etc, but that doesn't matter!)

Thanks!!

aranthorn 11-18-2005 10:55 PM

no problems in vb3.5 gold

shama 11-19-2005 03:20 AM

I will try this one and I hope it works with me :)

aranthorn 12-05-2005 07:30 PM

Had to un-install, way too much load with 100+ users on line.


All times are GMT. The time now is 11:39 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.01445 seconds
  • Memory Usage 1,850KB
  • 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
  • (3)bbcode_html_printable
  • (4)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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