Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vB3 Forum Quick Stats Cache Serialize Hack v1.1 Details »»
vB3 Forum Quick Stats Cache Serialize Hack v1.1
Version: 1.00, by Boofo Boofo is offline
Developer Last Online: Jun 2012 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 02-14-2004 Last Update: Never Installs: 36
 
No support by the author.

vB3 Forum Quick Stats Cache Serialize Hack
Version 1.1
(By Boofo)

What does this hack do?
It will display stats about each forum at the top of that forum. (NOTE: The attachments info will NOT show in forums that have no attachments.) Also included in the hack is Logician's vB2 "Last Post Minute Hack" (with his permission for the vB2 version, of course) optimized and redone for vB3. It now uses NO queries to get the last minute info. This hack will display a link the last post and the time the last post was made (i.e. "1 minute" or "2 days", etc.) as well as the name and link to the last poster in the forum. The stats are cached and the cache is only updated at a time set by you. With an option in the Admin CP, you can reset the time between cache updates without having to edit any more files once this hack is installed. This hack will add 1 optimized query (for the user's threads and replies stats) on a cache read, but since this hack is serialized, the cache read itself will not pull a query. On a cache update, it will add 6 queries to update the datastore. And then drop back down to the one query until the next cache update. This hack will make a cache in the datastore for each forum you have, so you don't have to worry about forums getting cross-cached with this hack. It has been thorughly tested on my site, but as we all know too well, sites can, and often do, vary in the way a hack performs on it. I forsee no problems of any kind on any site in the way this hack functions. It's basically pretty simple and hard to mess up.

Note: This is the setting for the time interval (in minutes) that you want the cache to be updated on. The default value is 10 minutes. The following code is in the forumdisplay.php part of this hack.

$updatetime = 10;

Once you install the Admin CP setting (at the end of this file), you will be able to update this from the Admin CP vBulletin Options settings.

Credits:
A BIG thank you goes out to KirbyDE for all of his guidance and patience while this hack was being written and tested. This hack might never have gotten past the dreamed up state if it wasn't for him. And it definately wouldn't have been finished by now or turned out as optimized as it is. Thank you, my friend. I learned a lot from you on our little adventure here. It was definately worth the trip.

Version Information:
Version 1.0
--Initial release
Version 1.1 --Corrected a few minor potential bugs and re-did the template. Now it has a cleaner look.

Installation overview:
Files to edit: (1)
--forumdisplay.php
Templates to add: (1)
--forumdisplay_quickstats
Templates to edit: (1)
--forumdisplay
Settings to add: (1)
--forumcachetime

Note: The first image below will show the forum quick stats for a forum that has attachments. The second image will show the forum quick stats for a forum that has no attachments.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #112  
Old 06-21-2004, 06:59 PM
pjdaley pjdaley is offline
 
Join Date: Feb 2004
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

(install has been clicked).... boooofooooo i need this hackkkkk.... is it hard to do? count threads of alot of forums to one sum?
Reply With Quote
  #113  
Old 06-21-2004, 07:03 PM
pjdaley pjdaley is offline
 
Join Date: Feb 2004
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that one has all the forums into 1 sum right? i can just choose 5? forums to count? (good job by the way)
Reply With Quote
  #114  
Old 06-22-2004, 07:07 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by pjdaley
that one has all the forums into 1 sum right? i can just choose 5? forums to count? (good job by the way)
No, that hacks shows ALL of the threads that each user has started right next to how many posts they have made, in the postbit.
Reply With Quote
  #115  
Old 07-12-2004, 06:39 AM
Nj?rd Eriksson Nj?rd Eriksson is offline
 
Join Date: Jul 2003
Location: Midg?rd
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
But after you deleted the users and updated the counters, it should have straightened itself out. Did you update the theread and forum counters as well as the postcount? You need to do that, too.
Yes, I have updated all these counters. I do so quite regularly, whenever I change someone's username. However, vBulletin keeps a number of user records that equals the total number of registrations; and not the active registrations. All those users that have been pruned seem to be assigned no user ID (or an ID of 0) -- that's what I assume at least.

I also have been mistaken about this user "Strapu", which allegedly is the "Top Thread Starter" in this forum:

Top Threads: Strapu (117 Threads = 12.39%)

He did indeed exist, and has been pruned at some stage (what explains his user ID 0). He, however, definitely didn't start 117 threads in this forum -- that's rather the number of threads started by all pruned users combined. He did create -- amongst others -- the first thread in this forum, however.

The

Top Posts: (1,117 Posts = 7.83%)

problem where no user is displayed is then probably related. That should again be the total number of posts made by all pruned users combined.
Reply With Quote
  #116  
Old 07-18-2004, 09:30 PM
Osterling Osterling is offline
 
Join Date: Jan 2004
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

These maybe two stupid qestiosn but..

1.) how do you debug
and
2.) how do you add a settings
Reply With Quote
  #117  
Old 07-20-2004, 09:00 PM
Osterling Osterling is offline
 
Join Date: Jan 2004
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone?
Reply With Quote
  #118  
Old 08-19-2004, 02:54 AM
Elmer's Avatar
Elmer Elmer is offline
 
Join Date: Aug 2002
Location: Washington DC
Posts: 211
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by exasko
anyone?
Edit your config.php and put this variable anywhere in the config.php file

$debug = "1";

next, go to your admincp and in your vBulletin Options select Forum Display Option (forumdisplay)
onece there, just click the link Add New Setting

that should work
Reply With Quote
  #119  
Old 08-20-2005, 11:10 PM
psico psico is offline
 
Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is a problem with the queries, I found the solution:

In forumdisplay.php find this code:
PHP Code:
        $topthreads $DB_site->query_first("
                SELECT COUNT(threadid) as threads, postusername, postuserid
                FROM " 
TABLE_PREFIX "thread
                WHERE forumid=
$forumid
                GROUP BY postuserid
                ORDER BY threads DESC, dateline ASC
                LIMIT 1
        "
);

        
$topposter $DB_site->query_first("
                SELECT user.userid, user.username, COUNT(post.postid) AS postcount
                FROM " 
TABLE_PREFIX "post
                LEFT JOIN " 
TABLE_PREFIX "thread ON (post.threadid = thread.threadid)
                LEFT JOIN " 
TABLE_PREFIX "user ON (post.userid = user.userid)
                WHERE thread.forumid=
$forumid
                GROUP BY post.userid
                ORDER BY postcount DESC
                LIMIT 1
        "
); 
Replace with this code:

PHP Code:
        $topthreads $DB_site->query_first("
                SELECT COUNT(threadid) as threads, postusername, postuserid
                FROM " 
TABLE_PREFIX "thread
                WHERE forumid=
$forumid  AND postuserid <> 0
                GROUP BY postuserid
                ORDER BY threads DESC, dateline ASC
                LIMIT 1
        "
);

        
$topposter $DB_site->query_first("
                SELECT user.userid, user.username, COUNT(post.postid) AS postcount
                FROM " 
TABLE_PREFIX "post
                LEFT JOIN " 
TABLE_PREFIX "thread ON (post.threadid = thread.threadid)
                LEFT JOIN " 
TABLE_PREFIX "user ON (post.userid = user.userid)
                WHERE thread.forumid=
$forumid AND user.userid IS NOT NULL AND user.username IS NOT NULL
                GROUP BY post.userid
                ORDER BY postcount DESC
                LIMIT 1
        "
); 
That's all!

See ya.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:33 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.11383 seconds
  • Memory Usage 2,312KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete