#16010 closed defect (bug) (wontfix)
get_comments() returns as result (by default) comments that were not approved.
Reported by: | mati1000 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0.3 |
Component: | Comments | Keywords: | |
Focuses: | Cc: |
Description
I see two problems in behavior of "get_comments()" function (wp-includes/comments.php: 180).
- 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 think that there is no support of cookies of current responder. In other words, a parameter that allows the following functionality does not exist.
comment_approved = '1 'OR (comment_author =% s AND comment_author_email =% s AND comment_approved = '0')
( wp-includes/comments-template.php: 852)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Replying to mati1000:
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.
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.
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.