Current time: 05-24-2012, 11:42 PM Hello There, Guest! (LoginRegister)


 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Reply count when unapproved thread is edited [C-Rcpalace]
01-31-2009, 06:12 PM (This post was last modified: 01-31-2009 06:54 PM by MattRogowski.)
Post: #1
[F] Reply count when unapproved thread is edited [C-Rcpalace]
Something's very wrong with this.

See these 2 threads:

http://community.mybboard.net/thread-44380.html
http://community.mybboard.net/thread-44441.html

The reply count on the forum display page is out of sync with the number of replies, it's over-counting. Both of these threads were unapproved at some point. When the thread is unapproved, and you edit the first post, the reply count goes up by one. Also, if a post is unapproved, and then edited, the number of unapproved posts goes down by one from the forum display page.

Further confirmation can be found from this post onwards in a support thread: http://community.mybboard.net/thread-442...#pid305429

To reproduce, make a thread, unapprove it, edit the first post a few times, and you'll see the reply count increases.

Happens here, and SVN. A r/c & r/b fixes it though.

Download My Plugins
My Personal Site - Twitter
[Image: eX4bjF]
Visit this user's website Find all posts by this user
02-07-2009, 05:47 AM
Post: #2
RE: Reply count when unapproved thread is edited
See if this fixes it:
Find in inc/datahandlers/post.php:
PHP Code:
            if($forum['mod_edit_posts'] == && !is_moderator($post['fid'], ""$post['uid']))
            {
                if(
$existing_post['visible'] == 1)
                {
                    
update_thread_data($existing_post['tid']);
                    
update_thread_counters($existing_post['tid'], array('replies' => '-1''unapprovedposts' => '+1'));
                    
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '+1''unapprovedposts' => '+1'));
                    
                    
// Subtract from the users post count
                    // Update the post count if this forum allows post counts to be tracked
                    
if($forum['usepostcounts'] != 0)
                    {
                        
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$existing_post['uid']}'");
                    }
                }
                
$visible 0;
            }
            else
            {
                if(
$existing_post['visible'] == 0)
                {
                    
update_thread_data($existing_post['tid']);
                    
update_thread_counters($existing_post['tid'], array('replies' => '+1''unapprovedposts' => '-1'));
                    
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '-1''unapprovedposts' => '-1'));
                    
                    
// Update the post count if this forum allows post counts to be tracked
                    
if($forum['usepostcounts'] != 0)
                    {
                        
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum+1 WHERE uid='{$existing_post['uid']}'");
                    }
                }
                
$visible 1;
            } 
Replace with:
PHP Code:
        if(isset($post['visible']) && $post['visible'] != $existing_post['visible'])
        {
            if(
$forum['mod_edit_posts'] == && !is_moderator($post['fid'], ""$post['uid']))
            {
                if(
$existing_post['visible'] == 1)
                {
                    
update_thread_data($existing_post['tid']);
                    
update_thread_counters($existing_post['tid'], array('replies' => '-1''unapprovedposts' => '+1'));
                    
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '+1''unapprovedposts' => '+1'));
                    
                    
// Subtract from the users post count
                    // Update the post count if this forum allows post counts to be tracked
                    
if($forum['usepostcounts'] != 0)
                    {
                        
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$existing_post['uid']}'");
                    }
                }
                
$visible 0;
            }
            else
            {
                if(
$existing_post['visible'] == 0)
                {
                    
update_thread_data($existing_post['tid']);
                    
update_thread_counters($existing_post['tid'], array('replies' => '+1''unapprovedposts' => '-1'));
                    
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '-1''unapprovedposts' => '-1'));
                    
                    
// Update the post count if this forum allows post counts to be tracked
                    
if($forum['usepostcounts'] != 0)
                    {
                        
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum+1 WHERE uid='{$existing_post['uid']}'");
                    }
                }
                
$visible 1;
            }
        }
        else
        {
            
$visible = ($forum['mod_edit_posts'] != || is_moderator($post['fid'], ""$post['uid']));
        } 
Visit this user's website Find all posts by this user
02-07-2009, 12:47 PM
Post: #3
RE: Reply count when unapproved thread is edited
That seems to fix it Smile

Download My Plugins
My Personal Site - Twitter
[Image: eX4bjF]
Visit this user's website Find all posts by this user
02-08-2009, 05:43 PM
Post: #4
[F] Reply count when unapproved thread is edited
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Visit this user's website Find all posts by this user


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication