vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Ignoring private forum's post/thread count in statistics (https://vborg.vbsupport.ru/showthread.php?t=298338)

Cable_Player 05-20-2013 08:02 PM

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.

nerbert 05-21-2013 12:27 AM

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

Cable_Player 05-21-2013 06:03 AM

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 :)

Lynne 05-21-2013 02:42 PM

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.

Cable_Player 05-21-2013 09:08 PM

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?

Lynne 05-22-2013 02:09 AM

You would use something more like this:

PHP Code:

        if (!in_array($forum['forumid'], array (xyz))) {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
        } 


Cable_Player 05-22-2013 02:38 PM

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'];
        }  
    }



Cable_Player 05-26-2013 06:54 PM

Has there been any progress on this?
Thanks

Lynne 05-26-2013 08:13 PM

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.

Simon Lloyd 05-26-2013 08:21 PM

I assume it's because the figures have already been consolidated in the database.


All times are GMT. The time now is 02:56 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.01158 seconds
  • Memory Usage 1,748KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)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
  • (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