Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Reply count when unapproved thread is edited [C-Rcpalace]
#1
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.
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
#2
See if this fixes it:
Find in inc/datahandlers/post.php:
			if($forum['mod_edit_posts'] == 1 && !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:
		if(isset($post['visible']) && $post['visible'] != $existing_post['visible'])
		{
			if($forum['mod_edit_posts'] == 1 && !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'] != 1 || is_moderator($post['fid'], "", $post['uid']));
		}
#3
That seems to fix it Smile
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
#4
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


Forum Jump:


Users browsing this thread: 1 Guest(s)