Ignore specified forums from statistics

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Scam Warning
Post Reply
Restless Rancor
Registered User
Posts: 99
Joined: Tue Sep 18, 2018 1:51 pm

Ignore specified forums from statistics

Post by Restless Rancor » Tue Sep 18, 2018 6:14 pm

Hi, I used to use the following code in 3.0.x to ignore specified forum's post counts in the board statistics (so private forums would not distort the figures for regular members):

root/index.php find:

Code: Select all

$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';
add after:

Code: Select all

$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;
This doesn't work in 3.2.3 but hopefully it's easily adaptable. Would someone be able to provide an updated method please? It doesn't necessarily have to be an entirely new extension, just the file edits are fine.
Thanks!
These aren't the droids you're looking for...
My snippets | I'm currently (slowly) learning php as a hobby, aiming to be able to write somewhat useful extensions. :roll:

User avatar
Mick
Support Team Member
Support Team Member
Posts: 20102
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Ignore specified forums from statistics

Post by Mick » Wed Sep 19, 2018 12:43 pm

If you want file edits (not recommended) you should post in phpBB custom coding otherwise stay here for an extension to be built.
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.

Restless Rancor
Registered User
Posts: 99
Joined: Tue Sep 18, 2018 1:51 pm

Re: Ignore specified forums from statistics

Post by Restless Rancor » Wed Sep 19, 2018 1:41 pm

Hi Mick,
I'll post over there as I'm happy to make the file changes (I'm running a test board so if it breaks it's fine). I'm a little surprised this isn't already an extension; most forums surely have a private section, probably with post increment turned off for users, so you'd think people wouldn't want the board statistics being influenced by them! That said I am quite set in how I like to do things :roll:

Thanks
These aren't the droids you're looking for...
My snippets | I'm currently (slowly) learning php as a hobby, aiming to be able to write somewhat useful extensions. :roll:

User avatar
Lumpy Burgertushie
Registered User
Posts: 65025
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Ignore specified forums from statistics

Post by Lumpy Burgertushie » Wed Sep 19, 2018 8:30 pm

lots of people want to figure out a way to increase the post totals on their board. we get a lot of requests for that but very few want to reduce them.

robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

Restless Rancor
Registered User
Posts: 99
Joined: Tue Sep 18, 2018 1:51 pm

Re: Ignore specified forums from statistics

Post by Restless Rancor » Wed Sep 19, 2018 8:34 pm

Hi Robert, I can see why that would be unusual.
The reason for it is I'd like the private forums (mainly just the one for the admins and moderators) to be entirely private, as if they didn't exist. The only thing stopping this from happening is that the posts are counted in the board statistics :cry:
These aren't the droids you're looking for...
My snippets | I'm currently (slowly) learning php as a hobby, aiming to be able to write somewhat useful extensions. :roll:

User avatar
david63
Jr. Extension Validator
Posts: 14723
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Ignore specified forums from statistics

Post by david63 » Wed Sep 19, 2018 8:43 pm

I doubt that many, if any, members would go through the board to manually check the data in the statistics and if they did then I would also doubt that they would be that bothered about it.

If it is such a problem then simply remove the statistics.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

Restless Rancor
Registered User
Posts: 99
Joined: Tue Sep 18, 2018 1:51 pm

Re: Ignore specified forums from statistics

Post by Restless Rancor » Wed Sep 19, 2018 8:52 pm

david63 wrote:
Wed Sep 19, 2018 8:43 pm
I doubt that many, if any, members would go through the board to manually check the data in the statistics and if they did then I would also doubt that they would be that bothered about it.

If it is such a problem then simply remove the statistics.
Hi, that is a valid point, but I'd rather be able to exclude them if someone is able to help me with that.
Thanks

Edit:
I understand why this wouldn't be taken on as an extension, at the end of the day it'd have to be something a reasonable number of people would want and I doubt many people would want this.

This topic could probably be locked now as my post in the custom coding forum (viewtopic.php?f=641&t=2486701) has been responded to. Sorry for the confusion.
These aren't the droids you're looking for...
My snippets | I'm currently (slowly) learning php as a hobby, aiming to be able to write somewhat useful extensions. :roll:

Post Reply

Return to “Extension Requests”

Who is online

Users browsing this forum: </Solidjeuh> and 14 guests