Opened 3 years ago
Last modified 23 months ago
#3429 new defect (bug)
bbp_increase_user_topic_count incorrect for first user post
Reported by: | Robin W | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Component - Topics | Keywords: | has-patch |
Cc: | naxoc |
Description
bbp_increase_user_topic_count and bbp_increase_user_reply_count both incorrectly calculate the count for a first post by an author making it 2 not 1.
This is because the function looks at the user reply count, and if empty (as it will be for a first post) uses bbp_get_user_topic_count_raw to count the topics or bbp_get_user_reply_count_raw to count the replies.
It then increments this count by 1.
However since the topic or reply for that author has already been created by the time this bbp_get_user_topic_count_raw count happens, then it is counted here and then incremeted by 1 which makes it 2.
I tried for a stab at some code to solve this. It might be better to solve this earlier in the execution, but since the raw call has the truth I figured it could work.
It relies on a long comment to explain what is going on, which is not ideal but it's a start.