[wp-trac] [WordPress Trac] #16010: get_comments() returns as result (by default) comments that were not approved.

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 28 16:57:18 UTC 2010


#16010: get_comments()  returns as result (by default) comments that were not
approved.
--------------------------+------------------------------
 Reporter:  mati1000      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Comments      |     Version:  3.0.3
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by duck_):

 Replying to [ticket:16010 mati1000]:
 > 1. The function returns as result (by default) comments that were
 approved and also comments that were not approved.
 > I think that this does not fit the standard of all functions in WP that
 by default return only posts/comments that have been published/approved.

 I don't think that this kind of API behaviour will be changed now. Though,
 yes, it could be argued as inconsistent with get_posts returning published
 by default.

 > 2. I think that there is no support of cookies of current responder. In
 other words, a parameter that allows the following functionality does not
 exist.

 There is better support in 3.1 for this kind of searching, see
 WP_Comment_Query and the search parameter in wp-includes/comment.php,
 though haven't tested to see how complicated you can make these.

 > comment_approved = '1 'OR (comment_author =% s AND comment_author_email
 =% s AND comment_approved = '0')
 > ( wp-includes/comments-template.php: 852)

 That specific query still seems to be unsupported by WP_Comment_Query in
 3.1 as get_search_sql only implodes with OR... maybe an operator argument
 (for future)? This might have been discussed on another ticket when this
 was being implemented though I haven't searched for it.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16010#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list