[wp-trac] [WordPress Trac] #20108: Comment counts not updated from edit-form-comment.php

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 23 18:00:03 UTC 2012


#20108: Comment counts not updated from edit-form-comment.php
--------------------------+-----------------------------
 Reporter:  dllh          |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 Repro:

 1. On a site with some comments, visit the comments listing page in the
 admin.
 2. Observe the comment count on a post with several comments.
 3. Click to edit one of the comments and approve it or mark as spam as
 part of the edit.
 4. 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20108>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list