[wp-trac] [WordPress Trac] #29885: Add author__not_in for comment queries

WordPress Trac noreply at wordpress.org
Wed Oct 8 13:45:46 UTC 2014


#29885: Add author__not_in for comment queries
-----------------------------+---------------------------
 Reporter:  chriscct7        |       Owner:  boonebgorges
     Type:  feature request  |      Status:  accepted
 Priority:  normal           |   Milestone:  4.1
Component:  Query            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+---------------------------
Changes (by boonebgorges):

 * keywords:  needs-patch dev-feedback => needs-patch


Comment:

 chriscct7 - Thanks for chiming in. I think the `post_author__` arguments
 are still useful, so let's not discard them.

 Re parameter names: We should aim to parallel WP_Query as much as
 possible, to make things easier for developers. So that suggests
 `author__in` and `author__not_in`. As noted, we have to keep `user_id`
 around.

 Re internal logic: let's parse the existing `user_id` together with
 `author__in` and use the parsed value to build the `IN` clause.

 > What we could do to get around this is if the parameter
 comment_author__in isset, then we use that parameter and ignore the email
 and the id one.

 No, I don't think we can do this. Currently you can pass `user_id=5` and
 `author_email=boone at example.com` and you'll get back comments from *both*
 user 5 and boone at example.com. We can't have one of these params cancel the
 other one out. I do think we can parse together `user_id` and `author__in`
 in PHP, as noted above, but even this is optional - MySQL will figure out
 what to do with `AND user_id IN (3,4,5) AND user_id IN (3,4)`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29885#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list