News:

Wondering if this will always be free?  See why free is better.

Main Menu

Exclude boards from statistics?

Started by KeruS, April 25, 2008, 07:51:41 PM

Previous topic - Next topic

KeruS

Is there a way to exclude particular boards from being counted in the forum statistics all together? I can stop the board from counting posts, this reflects in the user's post count but the thread and post counts in statistics still rise.

Oldiesmann

There is no way to do this by default in SMF. It can probably be done by tweaking the code some, but I'm not sure how easy it would be to accomplish this. Why wouldn't you want the "Total topics" and "Total posts" to reflect the actual totals anyway?
Michael Eshom
Christian Metal Fans

stefann

I was wondering about this too, but I mainly wanted to exclude a forum from the 'Top 10 Topics (by replies)' as we have some forum games that currently dominate these stats. We don't really want them shown in this section, or really counted in the general statistics totals either. I will most likely hardcode this myself manually later provided it's easy enough, but would be interested to see if anyone else has done similar
full time lurker on freenode #smf

metallica48423

which sections are you wanting to exclude them from?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

stefann

I personally only want to remove our 'games' forum from the top 10 topics as the few topics there dwarf the rest of the forum in size, but this is right down the bottom of priorities of my personal little mods. Ideally it'd also be ignored from the general stats and top 10 posters too, but only if it's incredibly easy to do. We DO want to still see it listed in the top 10 boards as we only have 8 public ones as well as the history because our stats are so low anyway.

To implement anything capable of this for the standard release I think would be overkill, and it'd end up as 4 different options for each board to be excluded from General Statistics, Top 10 Boards, Top 10 Posts and/or Forum History individually. I don't know what a 'standard' version could do other than ignore from all 4, or perhaps add a single setting of which of the 4 are ignored globally
full time lurker on freenode #smf

metallica48423

I actually had an idea for a mod for this exact purpose (removing a board from stats including the latest posts on the board index)

its not that hard to add extra stuff to the where clause of the query.

in /Sources/Stats.php

find

        // Topic views top 10.
        $topic_view_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_views, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                ORDER BY t.num_views DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );


Replace:

        // Topic views top 10.
        $topic_view_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_views, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                        AND b.id_board != ###
                ORDER BY t.num_views DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );


Find:

        // Topic replies top 10.
        $topic_reply_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_replies, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                ORDER BY t.num_replies DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );


Replace:

        // Topic replies top 10.
        $topic_reply_result = $smcFunc['db_query']('', '
                SELECT m.subject, t.num_replies, t.id_board, t.id_topic, b.name
                FROM {db_prefix}topics AS t
                        INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
                        INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
                        AND b.id_board != {int:recycle_board}' : '') . ')
                WHERE {query_see_board}' . (!empty($topic_ids) ? '
                        AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
                        AND t.approved = {int:is_approved}' : '')) . '
                        AND b.id_board != ###
                ORDER BY t.num_replies DESC
                LIMIT 10',
                array(
                        'topic_list' => $topic_ids,
                        'recycle_board' => $modSettings['recycle_board'],
                        'is_approved' => 1,
                )
        );


Where ### is the ID of the board to leave out in both queries.  If you want to add more boards, just add another "AND b.id_board = ### below the existing one. 

Top 10 posters appears to pull from the data in the members table, rather than doing a COUNT(*) on the messages table, which is logical if you consider that the post count is stored as an integer in that table..  It'd require some potentially heavy sqlwork to remove the top 10 posters' posts in those boards from there.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

stefann

#6
Thanks for those metallica, I was hoping it would be that easy, and just using the plain member post count achieves exactly the same thing in my case as we don't count posts on that board anyway.

As for a mod, this would probably be a good idea if enough people use it to warrant the time to create it. Given people have to choose to install it having the 4 options per board (or now 3 as adjusting Top 10 Posters wouldn't be worth anyone's time) would be reasonable.
full time lurker on freenode #smf

Advertisement: