Just yesterday I've got a little bug. My own postcount was 0 but I had 2 posts ... And I don't even changed anything !
So I created a littke workaround in modcp.
file
around line
default code
- <? $count_sql[] = "UPDATE " . USERS_TABLE . " SET user_posts = users_posts - " . $row['posts'] . "
- WHERE user_id = " . $row['poster_id'];
code
- //set the new post count to [actual]-[delete] IF [actual] gt delete.
- $count_sql[] = "UPDATE " . USERS_TABLE . "
- SET user_posts = CASE
- WHEN user_posts >= " . $row['posts'] . " THEN user_posts - " . $row['posts'] . "
- ELSE 0
- END
- WHERE user_id = " . $row['poster_id'];
1) the author has more posts (in his postscount) than he's trying to delete. => default behavior
2) the author is trying to delete MORE posts than he have in his postscount. => set to 0 (because it would result in an negative number, and the field is unsigned (unsigned => does not allow negative numbers)).
Have a nice day.