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.


All times are GMT. The time now is 10:31 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.01194 seconds
  • Memory Usage 1,750KB
  • 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
  • (3)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
  • (10)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