Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-20-2013, 08:02 PM
Cable_Player Cable_Player is offline
 
Join Date: Apr 2012
Location: England
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Ignoring private forum's post/thread count in statistics

Hello,
I've used phpBB for some time now and have some code (which I now don't use as an actual modification has replaced it) which makes my private forum's post and topic count get ignored in the forum's overall statistics on the index page.

This is the code I was using for phpBB, I don't know if it'll be any use here at all:

Quote:
Open:
root/index.php

Find:
Code:
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
After, Add:
Code:
$sql = 'SELECT forum_id, forum_posts, forum_topics
        FROM ' . FORUMS_TABLE . '
        WHERE ' . $db->sql_in_set('forum_id', array(FORUM_ID, FORUM_ID2));
$result = $db->sql_query($sql);
$hidden_posts = 0;
$hidden_topics = 0;
while ($row = $db->sql_fetchrow($result))
{
    $hidden_posts += $row['forum_posts'];
    $hidden_topics += $row['forum_topics'];
}
$db->sql_freeresult($result);
$total_posts   = $config['num_posts'] - $hidden_posts;
$total_topics   = $config['num_topics'] - $hidden_topics;
Now replace "FORUM_ID, FORUM_ID2" with the correct forum ID's
I was hoping somebody could help me replicate it's effects on vB 4.2.1
I have some private forums (my staff forums at the moment) and the post and thread count from those forums is being counted in the overall statistics. This isn't so bad for boards with hundreds of thousands of posts because it isn't really noticeable, but for a forum which is only just launching people are going to ask where all of these extra posts are!!

Thank you.
Reply With Quote
  #2  
Old 05-21-2013, 12:27 AM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I understand correctly you just want to reduce your post count by the number of old posts. I see you can edit post counts in the user manager. As long as you don't rebuild the post count in the maintenance part it should just count up from whatever number you edit in
Reply With Quote
  #3  
Old 05-21-2013, 06:03 AM
Cable_Player Cable_Player is offline
 
Join Date: Apr 2012
Location: England
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,
No, I'm wanting to have the board index's statistics update to ignore the private forums.
At the bottom of every forum you've got the <Board Name> Statistics.

"Threads x Posts xx Members x Active Members x
Welcome to our newest member,"

When you create a private forum (one that only selected members can see) you can set it so their posts do not count towards their post count.
What I want is that their posts do not count towards the site statistics.

I hope that's clearer
Reply With Quote
  #4  
Old 05-21-2013, 02:42 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The $totalthreads and $totalposts is totalled up around line 620 of the forum.php file. So, it's probably easier to just not add in the $totalthreads and $totalposts from that forum. Put a condition around the lines like this:

PHP Code:
        if ($forum['forumid'] != xx) {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
        } 
Change xx to the forum you don't want to include in the thread/post count.
Reply With Quote
Благодарность от:
tbworld
  #5  
Old 05-21-2013, 09:08 PM
Cable_Player Cable_Player is offline
 
Join Date: Apr 2012
Location: England
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Fantastic, thank you. And if I were to include multiple forums would it simply be a case of putting a comma ',' between forum ID's?
Reply With Quote
  #6  
Old 05-22-2013, 02:09 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would use something more like this:

PHP Code:
        if (!in_array($forum['forumid'], array (xyz))) {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
        } 
Reply With Quote
  #7  
Old 05-22-2013, 02:38 PM
Cable_Player Cable_Player is offline
 
Join Date: Apr 2012
Location: England
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Brilliant, thank you. I'll give it a go now.

--------------- Added [DATE]1369237493[/DATE] at [TIME]1369237493[/TIME] ---------------

Hmm, it doesn't seem to have worked. I've refreshed the statistics, post counts and topic counts as well as cleared the system cache but no changes.

This is what I've got line 618 - 628 of root/forum.php
PHP Code:
if (is_array($vbulletin->forumcache))
{
    foreach (
$vbulletin->forumcache AS $forum)
    {
        if (
in_array($forum['forumid'], array (1011121314)))
        {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
        }  
    }

Reply With Quote
  #8  
Old 05-26-2013, 06:54 PM
Cable_Player Cable_Player is offline
 
Join Date: Apr 2012
Location: England
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Has there been any progress on this?
Thanks
Reply With Quote
  #9  
Old 05-26-2013, 08:13 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put that exact code (only different forumids) into the forum.php file on my test site and it changed the stats on the forum.php page.
Reply With Quote
  #10  
Old 05-26-2013, 08:21 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I assume it's because the figures have already been consolidated in the database.
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 08:14 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.04331 seconds
  • Memory Usage 2,269KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete