News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

BoardIndex.php, countChildPosts, deep hierarchy, bad message and topic counts

Started by jsanchez, December 05, 2007, 02:32:20 AM

Previous topic - Next topic

jsanchez

On a forum I administer, there are lots and lots of boards organized in a several levels hierarchy.  We find that the home page does not compute correctly the message and board counts.  The software is 1.1.4, has the spammenot mod and a few local fixes taken from this forum or that I will be reporting soon.  The theme is default, only changed to remove the navigation menu at the bottom that is too expensive when there are many boards.

We have found that a change is necessary to BoardIndex.php (the logic in MessageIndex.php seems correct).  After line 205 we read:

                       $parent_map[$row_board['ID_PARENT']][0]['topics'] += $row_board['numTopics'];
                       $parent_map[$row_board['ID_PARENT']][1]['posts'] += $row_board['numPosts'];
                       $parent_map[$row_board['ID_PARENT']][1]['topics'] += $row_board['numTopics'];
                       continue;

Before the "continue" line, the following line should be inserted:

                      $parent_map[$row_board['ID_BOARD']] = $parent_map[$row_board['ID_PARENT']];

After this change, totals seem correct, I have checked by hand the totals in several places.

Regards,

Julio


SleePy

Quick question.

Do you have "Count child's posts in parent's totals" checked in Admin -> Boards -> Settings?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

jsanchez

Quote from: SleePy on December 05, 2007, 02:51:10 PM
Quick question.

Do you have "Count child's posts in parent's totals" checked in Admin -> Boards -> Settings?

Yes.

Advertisement: