[wp-trac] [WordPress Trac] #35068: Comments not showing up when there are unapproved messages
WordPress Trac
noreply at wordpress.org
Mon Dec 14 20:59:33 UTC 2015
#35068: Comments not showing up when there are unapproved messages
-------------------------------------+--------------------
Reporter: arash_hemmat | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4.1
Component: Comments | Version: 4.4
Severity: critical | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+--------------------
Changes (by boonebgorges):
* keywords: => has-patch needs-testing
Comment:
[attachment:35068.diff] should make the problem fairly clear, but just to
spell it out a bit more: The improved paginated-comment queries in 4.4
work by only querying for the specific comments that the current comment-
page needs, rather than *all* of the post's comments. See #8071. We do
this by passing 'number' and 'offset' params to `WP_Comment_Query` in
`comments_template()`.
Generally, the calculation of 'number' and 'offset' is pretty simple,
given that we usually have `comments_per_page` and `cpage`. But the case
where 'default_comments_page=newest' and where we're looking at the post
permalink (no cpage) is a special one: we need to show the last page of
comments, but the only way to know the proper offset for the "last"
comments is to have a count of all comments on the post. The problem in
4.4 is that the total-top-level-comments-for-the-post query does not
account for 'comment_approved'.
https://core.trac.wordpress.org/browser/tags/4.4/src/wp-includes/comment-
template.php?marks=1316-1323#L1300
Could I get a second (and third and fourth) set of eyes on the patch and
tests? Sorry for the ugliness of the tests, btw - blame
`comments_template()`, not me :-D
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35068#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list