Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Total Thread Hits Per Forum Details »»
Total Thread Hits Per Forum
Version: 1.00, by eXtremeTim eXtremeTim is offline
Developer Last Online: Feb 2008 Show Printable Version Email this Page

Category: Forum Home Enhancements - Version: 2.2.x Rating:
Released: 08-19-2002 Last Update: Never Installs: 7
 
No support by the author.

This hack counts the total thread hits for each forum then displays it where every you put the variable. This hack adds one querie per forum unless the forum has no posts in it then it doesn't add on for that forum. It also currently does not count sub forums. I plan to work on that soon.

Demo: http://www.extremechatforums.com/forum/ look under any forum after the description where it says [New Thread]

Show Your Support

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

Comments
  #22  
Old 09-29-2002, 12:00 PM
Mutt's Avatar
Mutt Mutt is offline
 
Join Date: Nov 2001
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

see if this works. I stole it from a different hack that FireFly cleaned up and it seemed like it would work here too.


everything is new, so delete the old code


right above this
PHP Code:
// Start makeforumbit 
add this
PHP Code:
$getforumviews $DB_site->query('
    SELECT sum(views) AS hits, forumid
    FROM thread
    GROUP BY forumid
'
);
$forumviews = array();
while (
$getforumview $DB_site->fetch_array($getforumviews)) {
    
$forumviews[$getforumview['forumid']] = $getforumview['hits'];


then right above this
PHP Code:
        eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";"); 
add this
PHP Code:
    global $forumviews;
    
$forumhits $forumviews[$forum['forumid']];
    if (
intval($forumhits) < 1) {
        
$forumhits 0;
    } 
now add the var $forumhits where you want the number of total views per forum to appear. this should only add 1 querry regardless of the number of forums.


once my server is back up, I'll be installing this.
Reply With Quote
  #23  
Old 10-11-2002, 01:00 AM
Katman's Avatar
Katman Katman is offline
 
Join Date: Oct 2002
Location: New Glarus, WI
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't mention what files this hack needs to be placed in? Do I update the code in the index.php or fourmdisplay.php or both? Because "// Start makeforumbit" is listed in both of them in vB 2.2.8.
Reply With Quote
  #24  
Old 10-22-2002, 12:57 PM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Its in index.php.
Reply With Quote
  #25  
Old 04-16-2004, 02:12 PM
shanx25 shanx25 is offline
 
Join Date: Apr 2004
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am thinking about the same problem.

The best way of doing this imho is to have a "totalviews" column in the FORUM table. I keep updating this totalviews section on an hourly basis with a GROUPBY SQL similar to the one you use. It takes 0.0008 seconds on my server.

Now that this info is already in FORUM table, we can get this column along with the same SQL that gets all the other stuff.

In other words, there is *NO ADDITIONAL* query required.

Here is what I did:

1. Altered the "Forum" table to ADD an additional column:

"totalviews" (int(10))

2. Then, set up a cronjob to execute this code hourly (you can change timing to whatever you want of course) -- cron_update_forum_totalviews.php.txt. This code takes the total of all threads and puts them into the forum.

3. /includes/functions_forumlist.php

Find every occurence of replycount, and add the "totalviews" in a similar fashion. The attached /includes__functions_forumlist.php.txt file should tell you what I have added. Just search for the word replycount inside this file.

4. index.php

Find this code:
PHP Code:
if (is_array($forumcache)) 
This is the section where there are some references to "Replycount". I added stuff for "totalviews" so that my code looks like this:

PHP Code:
// get total threads & posts from the forumcache  
$totalthreads 0;  
$totalposts 0;  
$totalviews 0;  
if (
is_array($forumcache))  
{  
    foreach (
$forumcache AS $forum)  
    {
          
$totalthreads += $forum['threadcount'];
          
$totalposts += $forum['replycount']; 
         
$totalviews += $forum['totalviews'];  
    }  
}  
$totalthreads vb_number_format($totalthreads);  
$totalposts vb_number_format($totalposts);  
$totalviews vb_number_format($totalviews); 
Of course, all changes are included in the attached index.php.txt

Hope this helps someone in the future include VIEWS on forumhome (forum's home page). Let me know how it works out. I have it in a BBS that's under a password protected website, so cannot show example, but works like a charm. No extra queries!

-S
Reply With Quote
  #26  
Old 02-05-2007, 09:08 AM
vdi vdi is offline
 
Join Date: Jul 2003
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible, to get this hack for vBulletin® Version 3.6.4 ?
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:49 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.04313 seconds
  • Memory Usage 2,271KB
  • Queries Executed 20 (?)
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
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)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_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