Current time: 03-22-2010, 04:13 AM Hello There, Guest! (LoginRegister)


Unapproved threads post count
06-30-2009, 03:04 PM (This post was last modified: 07-01-2009 02:10 PM by MattRogowski.)
Post: #1
Unapproved threads post count
If a forum requires thread moderation, you see this on the forum display:

   

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:

   

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...

   

... and on the SVN.

My Personal Site - Twitter
MyBB Support Team
[Image: lqscs]
Visit this user's website Find all posts by this user
07-06-2009, 11:23 AM (This post was last modified: 07-06-2009 11:30 AM by Tomm M.)
Post: #2
RE: Unapproved threads post count
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

Tomm M
MyBB Developer » Marketing Designer & Systems Developer
Find all posts by this user
07-06-2009, 11:41 AM
Post: #3
RE: Unapproved threads post count
If you delete the post it will still show (1)....Have to do a rebuild the counters.
Find all posts by this user
07-06-2009, 11:59 AM
Post: #4
RE: Unapproved threads post count
No, it won't. I've also noticed that the rebuild also wipes out the unapproved counts... Shy

Tomm M
MyBB Developer » Marketing Designer & Systems Developer
Find all posts by this user
07-06-2009, 12:05 PM (This post was last modified: 07-06-2009 12:17 PM by MattRogowski.)
Post: #5
RE: Unapproved threads post count
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.

My Personal Site - Twitter
MyBB Support Team
[Image: lqscs]
Visit this user's website Find all posts by this user
07-06-2009, 12:14 PM
Post: #6
RE: Unapproved threads post count
Same here bro.
Find all posts by this user
07-06-2009, 12:55 PM
Post: #7
RE: Unapproved threads post count
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

[Image: ryangordon.png]
My Blog - My Mods
Visit this user's website Find all posts by this user
07-06-2009, 01:19 PM
Post: #8
RE: Unapproved threads post count
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:

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

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

PHP Code:
update_thread_counters($thread['tid'], array("replies" => 0"unapprovedposts" => 1)); 

Tomm M
MyBB Developer » Marketing Designer & Systems Developer
Find all posts by this user
07-06-2009, 02:26 PM
Post: #9
RE: Unapproved threads post count
Yeah, I remember that change too - Not sure why it was changed if it wasn't actually a bug or a proper fix.

[Image: ryangordon.png]
My Blog - My Mods
Visit this user's website Find all posts by this user
07-06-2009, 02:38 PM
Post: #10
RE: Unapproved threads post count
After looking through Redmine, I found it was this bug: http://community.mybboard.net/thread-48601.html

Tomm M
MyBB Developer » Marketing Designer & Systems Developer
Find all posts by this user


Forum Jump: