MyBB Community Forums

Full Version: Unapproved threads post count
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
If a forum requires thread moderation, you see this on the forum display:

[attachment=14542]

Says there's no replies, but one reply requiring moderation... there can't be a reply needing moderation if there aren't any replies, fairly sure it didn't always used to say the number in brackets when it was a new thread before. But, even if that bit is right, I can't remember if it's meant to be like that or not, the main issue is the next bit.

When you approve the thread, it shows the same:

[attachment=14543]

Again, no replies in the thread, but apparently one reply that needs to be moderated.

This happens on these forums, have a look at the plugin/theme release forum...

[attachment=14562]

... and on the SVN.
OK, this one is a pain... so keep them to yourself next time, Matt! Toungue

I managed to get the replies problem sorted, but another bug appeared in the forum counters. When you approve a new thread, the forum counters are updated with the number of replies. But, if you reply to an unapproved thread, it increments the forum counter anyway as it's classed as a new reply. Horrible stuff.

So, to resolve, I've came up with something that I know Ryan will probably hate... Shy

If you make a new reply to a thread that is unapproved, the reply is counted as an "unapproved post" (appears in brackets). As far as I can see, this is the only way that's possible without either A). Adding it to the count, and the forum count being incorrect (a recount/rebuild to fix); or B). not counting it at all, and running a query in the loop (in class_moderation.php) to get how many 'approved' replies there are in the unapproved thread; or C). doing A with the query from B to remove/add replies.

I went with the unapproved posts route simply because they can be classed as "hidden replies" (only moderators can see them). To me, it only makes sense, but I'd be happy to test a query in a foreach loop if needs be. Of course, the count is correct at thread level; this only appears on the index/forumdisplay. To explain, the thread itself will say "1" replies, whereas the forum will say "0 (2)" posts.

Thread View | Forum View
If you delete the post it will still show (1)....Have to do a rebuild the counters.
No, it won't. I've also noticed that the rebuild also wipes out the unapproved counts... Shy
One other thing I'll add (this should probably have been in the first post really Angel) is that I'm pretty damn sure this wasn't always happening, I've only really noticed it in the last week or two, so it might be that something that was changed in one of the recent upgrades has caused it... then again, I may have just completely missed it happening before, and I have no idea if anything related to this was changed in any recent updates, can't remember any related bug reports off the top of my head, but I suddenly started seeing it, on every thread that required moderation, and I couldn't remember ever seeing it before.
Same here bro.
I'll go ahead and be the one to fix this and any further issues that appear. Chris and I spent a lot of time specing out the functionality of how the counter system should work (use cases, scenarios, etc) so you are likely breaking some of those specs
More than likely(!).

I've found the initial problem Matt found (with the replies appearing in the unapproved thread in the threadlist). Funny how I even remember the exact line of code that was changed... Shy ... I can't find the bug report connected to it though.

In ./inc/datahandlers/post.php, find this:

update_thread_counters($this->tid, array("replies" => 0, "unapprovedposts" => 1));

Changing it back to the following removes the problem Matt reported.

update_thread_counters($thread['tid'], array("replies" => 0, "unapprovedposts" => 1));
Yeah, I remember that change too - Not sure why it was changed if it wasn't actually a bug or a proper fix.
After looking through Redmine, I found it was this bug: http://community.mybboard.net/thread-48601.html
Pages: 1 2