vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   [VB3 RC3] Who viewed this thread? (https://vborg.vbsupport.ru/showthread.php?t=61225)

Kentaurus 02-05-2004 10:00 PM

[VB3 RC3] Who viewed this thread?
 
I know there is already one version of this by Gary W but I already made (and documented) my own so I thought I would post it.

Advantages of my hack:

My hack adds only 1 query to showthread, and it only queries the user table, so it is less server intensive. That is important to any busy board or anyone that wants to save some resources. It integrates with the "thread views" system to update the people that have seen the thread.

Disadvantages:

Well.. with mine even if you browse the forum as "invisible" you would end up showing in the "who read" list.


Info for hackers:
You may modify, improve, upgrade, redistribute this hack, include it
in another hack or yours or translate it provided you do it free of
charge and you distribute it in www.vbulletin.org at least, there is no
need to pm me asking for permission
Some portions of the code are (c) Jelsoft Enterprises Ltd.

Boofo 02-06-2004 03:32 AM

Looks good. I trust how you support your hacks much more than the other one. ;)

*arie 02-06-2004 04:14 AM

cool. :)

any way to limit the view only to admins?

gmarik 02-06-2004 08:44 AM

Great. Could it be that the add-on who downloaded this attachment would be combined with this?

Kentaurus 02-06-2004 03:45 PM

Quote:

Originally Posted by *arie
cool. :)

any way to limit the view only to admins?

in the template showthread, this:

Quote:

<if condition="$+++++ad">
<table cellpadding="10" cellspacing="0" border="1" width="100%">
<tr valign="top">
<td class="alt1">Users that have seen this thread: <b>$+++++ad</b></td></tr></table><br/>
</if>
replace it white:

Quote:

<if condition="$+++++ad and $bbuserinfo[usergroupid]==6">
<table cellpadding="10" cellspacing="0" border="1" width="100%">
<tr valign="top">
<td class="alt1">Users that have seen this thread: <b>$+++++ad</b></td></tr></table><br/>
</if>

Then only admins would be able to view it



those '+' are a w h o r e a d, seems that the forum is censoring it.

Kentaurus 02-06-2004 03:49 PM

Quote:

Originally Posted by gmarik
Great. Could it be that the add-on who downloaded this attachment would be combined with this?

Do you mean Rein's Who Downloaded? It shouldn't be any problem if both hacks are installed.

Kentaurus 02-06-2004 04:23 PM

An update for this hack:

With this modification the "who viewed" list will be ordered alfabetically, the original behaviour was to order the users as they saw the thread, but that's not very reliable. Apply this modification only if you would like to see the list ordered.

search for this

Code:

                if ($threadidcache)
                                {

replace that with
Code:

                if ($threadidcache)
                                {
asort($+++++adarray);

search for this

Code:

                                $+++++adarray[$bbuserinfo['userid']] = $bbuserinfo['username'];
replace that with

Code:

                                $+++++adarray[$bbuserinfo['userid']] = $bbuserinfo['username'];
asort($+++++adarray);

TXT and HTL updated of course :)

And... all the +++++ are the word: w h o r e

the complete word is w h o r e a d
being censored

Allan 02-06-2004 04:57 PM

Thank you Kentaurus, very nice hack !

Boofo 02-07-2004 04:17 AM

Hey, buddy, I have a request. Is there a way to have the names follow the color and intensity (html mark-up, I think it is called) like Admins and Supermods and users and such? It would make it easier to identify with a quick glance as the list grows. ;)

And maybe the total numbers of members and guests (if they are allowe to read the threads like mine are) who have read the thread so far?

Boofo 02-07-2004 04:57 AM

The sorting feature doesn't seem to be working for me. I have me (Boofo) in the list, the next one strats with an M and the next one strats with an A. They are not going alphabetically. ;)

Kentaurus 02-07-2004 05:26 AM

Quote:

Originally Posted by Boofo
The sorting feature doesn't seem to be working for me. I have me (Boofo) in the list, the next one strats with an M and the next one strats with an A. They are not going alphabetically. ;)

The sort will only work in new threads or threads where the list needs to be updated, if the who viewed is already stored for a thread then it won't be sorted. Call it an insertion sort :) It only sorts when something is added.

I'll check for that username markup, shouldn't be that hard to modify, but keep in mind that a query is needed for that. It is not an update query so it shouldn't hurt a lot the performance but still for people that are trying to mantain queries to a minimum (like me) an extra query might not sound practical.

Kentaurus 02-07-2004 06:04 AM

Here is the first one. For people that already installed the hack and want to add how many users have seen the thread:

In the showthread.php file, this:
Code:

$+++++ad = @implode(", ",$+++++adarray);
Replace it with:
Code:

$+++++ad = @implode(", ",$+++++adarray);
$total+++++ad = @count($+++++adarray);

In the SHOWTHREAD template, this:
Code:

Users that have seen this thread:
Replace it with:
Code:

$total+++++ad users have seen this thread:
Guests are a little more difficult because it means storing ip addreses as well instead of userid's. I'l check if there is an easy way to do it.

Those +++ are the word w h o r e that even if its a substring it is still being censored (/me makes a note on not using variable names that might be censored).

TXT file updated

Boofo 02-07-2004 08:28 AM

Is there any way to run a query to sort the users who have already seen a thread so it can strat off alphabetically from now on?

Can you just use the code in vBulletin for who is browsing this thread now to get the html markup that it is using already? ;)

squawell 02-07-2004 09:18 AM

i got this error when i run scheduled task in my admincp
Code:

Warning: asort() expects parameter 1 to be array, boolean given in C:\Apache Group\Apache2\htdocs\forum\includes\cron\threadviews.php on line 41
the line 41 is
Code:

asort($+++++adarray);
any idea?thankz

edit:delete the line 41 than it works:D

Kentaurus 02-07-2004 06:51 PM

Quote:

Originally Posted by squawell
i got this error when i run scheduled task in my admincp
Code:

Warning: asort() expects parameter 1 to be array, boolean given in C:\Apache Group\Apache2\htdocs\forum\includes\cron\threadviews.php on line 41
the line 41 is
Code:

asort($+++++adarray);
any idea?thankz

edit:delete the line 41 than it works:D

Don't worry about it, it's a warning (it doesn't stop the code from executing), that's because some threads might not have any data to sort. If you really don't want to see the warning change it to this:

Code:

if (is_array($+++++adarray)) {
asort($+++++adarray);
}


Boofo 02-07-2004 07:40 PM

Quote:

Originally Posted by Kentaurus
Here is the first one. For people that already installed the hack and want to add how many users have seen the thread:

In the showthread.php file, this:
Code:

$+++++ad = @implode(", ",$+++++adarray);
Replace it with:
Code:

$+++++ad = @implode(", ",$+++++adarray);
$total+++++ad = @count($+++++adarray);

In the SHOWTHREAD template, this:
Code:

Users that have seen this thread:
Replace it with:
Code:

$total+++++ad users have seen this thread:
Guests are a little more difficult because it means storing ip addreses as well instead of userid's. I'l check if there is an easy way to do it.

Those +++ are the word w h o r e that even if its a substring it is still being censored (/me makes a note on not using variable names that might be censored).

TXT file updated

On guests, maybe just do a guest count?

Kentaurus 02-08-2004 08:01 PM

Here is another update

As requested by Boofo, to make the users appear with the html markup as they appear in the online users and almost anywhere, at the cost of 1 query.

I'm now attaching a txt since I'm getting tired of that censor.....

For threads before I added the sorting piece, just create a new user and view the unsorted thread, it will be sorted.

Boofo 02-08-2004 08:08 PM

That's Boofo, not Boofoo. ;)

And thank you, sir. ;)

Boofo 02-08-2004 08:34 PM

That worked great! Thank you, again. ;)

You forgot to add the space after the comma in this line. The names were all running together. But I fixed it on my site. ;)

PHP Code:

 $+++++ad = @implode(",", $+++++adnames); 


Boofo 02-09-2004 12:57 AM

Now I'm getting nothing but DB errors with this. I emailed you about it.

Kentaurus 02-09-2004 01:18 AM

Seems that there we some cases I didn't consider. I fixed it already and uploaded an updated txt. For the people that installed it please change:

(and there we go with this censor...)

PHP Code:

$+++++adids array_keys($+++++adarray);
$+++++
sult $DB_site->query("SELECT user.* FROM ".TABLE_PREFIX."user AS user WHERE userid IN (".implode(",",$+++++adids).")");
while (
$whodata $DB_site->fetch_array($+++++sult))
{
    $+++++
adnames[] = fetch_musername($whodata); 
}
$+++++
ad = @implode(",", $+++++adnames); 

to:

PHP Code:

    if (!empty($+++++adarray))
    {
 
     $+++++
adids array_keys($+++++adarray);
     $+++++
sult $DB_site->query("SELECT user.* FROM ".TABLE_PREFIX."user AS user WHERE userid IN (".implode(",",$+++++adids).")");
     while (
$whodata $DB_site->fetch_array($+++++sult))
     {
         $+++++
adnames[] = fetch_musername($whodata); 
     }
     $+++++
ad = @implode(",", $+++++adnames);
        
$total+++++ad = @count($+++++adarray);
    } 

it is already in the txt

Boofo 02-11-2004 08:08 AM

It still isn't sorting the names quite right. In that list of names I sent you in the email, the last name is still showing up out of order. Any way to fix that? ;)

Kentaurus 02-12-2004 12:19 AM

Quote:

Originally Posted by Boofo
It still isn't sorting the names quite right. In that list of names I sent you in the email, the last name is still showing up out of order. Any way to fix that? ;)

Then I'll write a small script to sort them, just give me some time :)

WAR 02-12-2004 12:44 AM

were you planning on releasing an htl compliant version again at some point?
(I was going to wait until then if so)

Kentaurus 02-12-2004 01:09 AM

Quote:

Originally Posted by WAR
were you planning on releasing an htl compliant version again at some point?
(I was going to wait until then if so)

When HTL 1.1 is ready, maybe. It's just that editing both the HTL and the TXT is some time consuming.

Boofo 02-12-2004 01:32 AM

Quote:

Originally Posted by Kentaurus
Then I'll write a small script to sort them, just give me some time :)

Ok, I'll be here waiting. ;)

Kentaurus 02-13-2004 02:17 PM

Quote:

Originally Posted by Boofo
Ok, I'll be here waiting. ;)

It only happened with the colors highlight .... it was an "error" in the query (actually the order by was missing).

Code:

                $+++++sult = $DB_site->query("SELECT user.* FROM ".TABLE_PREFIX."user AS user WHERE userid IN (".implode(",",$+++++adids).")");
change it to
Code:

                $+++++sult = $DB_site->query("SELECT user.* FROM ".TABLE_PREFIX."user AS user WHERE userid IN (".implode(",",$+++++adids).") ORDER BY username");
If that doesn't work take a broom and hit the hack... err.. I'll fix it again.

whoviewed_colors.txt updated also

Boofo 02-13-2004 09:16 PM

You can hold off on the broom. That fixed it. ;)Thank you kindly, sir. ;)

Alas-Digitales 02-14-2004 03:44 PM

Would be possible that the usersnames had a link to their profile?

Boofo 03-18-2004 10:26 PM

Yes, would it be possible to have the names linked to their profile? That would be excellent. ;)

Q8vbhacks 03-26-2004 06:52 AM

tahnks Kentaurus

can we use it to Specified forums .

weaver 03-28-2004 04:38 PM

I checked the code and I had some likes of ************* without any // in front of them. I got rid of those and there isn't an error, but I don't see any names of who has viewed the thread either.

**Sorry didn't realize it was at the top of the screen. I was looking for it at the bottom.

Catch-22|BL 04-15-2004 11:27 AM

Good work as always, Kentaurus!

Smooth install and does exactly as described. :)

JaNa 04-26-2004 07:37 PM

Useful!

/me Clicks Install

tccra 05-12-2004 01:39 AM

Is this working in 3.0.1? No error messages but the list isn't showing up in my thread view pages.


edit: changed "$bbuserinfo[usergroupid]==6" to "is_member_of($bbuserinfo, 6)" and voila! It worked.

DCX 05-12-2004 05:12 AM

Quote:

Originally Posted by tccra
Is this working in 3.0.1? No error messages but the list isn't showing up in my thread view pages.


edit: changed "$bbuserinfo[usergroupid]==6" to "is_member_of($bbuserinfo, 6)" and voila! It worked.


same thing as me. i even changed the template as stated above and it still doesn't work for me. and i did it for only admins....

DCX 05-12-2004 06:56 AM

k, it's workin for me now. guess it takes time to load up when the members actually go to those posts AFTER the hack has been installed.....

Carter876 05-12-2004 01:41 PM

Kentaurus compliments for your nice hack, I have a little question:
Is there the possibility to see the last date and time in which the user has read the post? (It's very important for me to know it)

Tnx in advance :)

Regards

DCX 05-12-2004 03:30 PM

ok, it is working for me but i have a little problem... for some reason, it's not showing up on ALL threads.... it is showing on a majority of the threads though. any ideas?

Grendel 05-13-2004 05:56 PM

How is that done, if I want to limit the view to thread-starters only? Any idea?


All times are GMT. The time now is 04:47 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.01446 seconds
  • Memory Usage 1,846KB
  • 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
  • (19)bbcode_code_printable
  • (3)bbcode_php_printable
  • (12)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