Make WordPress Core

Opened 13 years ago

Closed 9 years ago

Last modified 9 years ago

#16010 closed defect (bug) (wontfix)

get_comments() returns as result (by default) comments that were not approved.

Reported by: mati1000's profile 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).

  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.

  1. 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)

#1 in reply to: ↑ description @duck_
13 years ago

Replying to 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.

  1. 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.

#2 @nacin
13 years ago

We can't change the functionality here at this point.

At most, maybe a 'published' flag that makes it obvious.

#3 @dd32
13 years ago

  • Milestone changed from Awaiting Review to Future Release

#4 @chriscct7
9 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Per Nacin's comment

#5 @DrewAPicture
9 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.