Opened 13 years ago
Closed 13 years ago
#20108 closed defect (bug) (fixed)
Comment counts not updated from edit-form-comment.php
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | 3.4 |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
Repro:
- On a site with some comments, visit the comments listing page in the admin.
- Observe the comment count on a post with several comments.
- Click to edit one of the comments and approve it or mark as spam as part of the edit.
- Observe the comment count for the post on the comments listing page again.
Expected Result: The comment count will increment or decrement.
Actual Result: The comment count doesn't change.
Further info: Because the ajax links on the listing page use a different method for updating the counts, these links work.
This is caused by the omission of an "echo" statement in edit-form-comment.php. This prevents the value that includes the comment_post_ID from being printed, which in turn causes the comment count to fail to update.
Specifically, in wp_update_comment_count() in wp-includes/comment.php, there's a check for deferred comment counting whose "elseif" checks for $post_id. If $post_id isn't found (it'll be "" thanks to this bug), then wp_update_comment_count_now() never fires.
Compare line 22 of edit-form-comments.php, which prints the comment_ID hidden field, to the line just below, which should print the comment_post_ID field. The first includes an echo that the second omits.
The attached patch adds the echo, which resolves the problem.
This dates back to [19612], in which some tidying up resulted in the dropped value. This so far appears in trunk only but might be nice to fix before the next release.
Adds omitted echo statement