Thread: Post count does not reset when posts are deleted. [Solved]

Started: March 10, 2010, 04:57 AM  ⋅  Zone: Public Forums  ⋅  Category: Bugs & Troubleshooting  ⋅  Posts: 2  ⋅  Views 244
Started by: john  ⋅  Description: No description.
Post #1
Member: john  ⋅  Date: March 10, 2010, 04:57 AM  ⋅ Subject: "Post count does not reset when posts are deleted."

Not noticeable unless you have a new site and able to count posts (which is where I'm at) -

Posts count does not reset when a post is deleted.

Got to be a good thing though that we're down to this level of problem reporting Laughing

Post #2
Member: Markus  ⋅  Date: March 10, 2010, 05:45 AM  ⋅ Subject: "Re: Post count does not reset when posts are deleted."

There's a little bug in the member post decrement feature when an administrator deletes a member's post.

Be sure to mention which counter drops out of the loop; I suppose you mean the member's posts counter (yes you do, just fixed it). I have covered increments and decrements to parent and category level counts in delete and move situations with posts and threads, as well as parents in categories and vice versa, at least I think I have! Debugging all that is something I haven't tagged as a super urgent on our list of priorities, especially since the idea is to get in place a general resynch tool into the Admin CP.

It's just one line of code in /core/ajax/tasks.php, and I notice we have a little bug on the radar (#323):

Queries::do_query(Queries::decrement_member_entries($_SESSION['member']['member_id']));

There's a little quirk above as you might guess by looking at it and thinking what might happen, as it will decrement the posts of the person logged in, and doesn't consider you might be an Admin and might be actually deleting someone else's posts. (And you will end up with minus posts in the end, unless you post more than you delete!) Simply change that line to:

Queries::do_query(Queries::decrement_member_entries($data['post_member_id']));

And that should take care of it. All the AJAX-based delete functions happen through this file. I've noticed some of the other counters can also get a bit out of synch in some situations, but haven't had the focus and interest to hunt them down systematically yet. If you spot such situations, please inform.

 

Bugs & Troubleshooting

Add to Favorites
Public Forums
Category  ⋅  Please report all bugs and discuss any problems in this forum.
 

Public Forums

Add to Favorites
Public Forums
Zone  ⋅ Public forum sections for support and discussions. Available for everyone.
 

Zone Categories

 
Questions? Ask us!
Back to Top