[wp-trac] [WordPress Trac] #22212: WP_User_Query( array('role' => $role) ) should accept array or not return anything if array

WordPress Trac noreply at wordpress.org
Tue Aug 13 13:14:21 UTC 2013


#22212: WP_User_Query( array('role' => $role) ) should accept array or not return
anything if array
-------------------------------------------------+-------------------------
 Reporter:  thomask                              |       Owner:
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  3.7
Component:  Users                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests needs-    |
  testing                                        |
-------------------------------------------------+-------------------------

Comment (by nacin):

 As users are allowed to have multiple roles, `role => array( role1, role2
 )` does seem confusing — is it an AND, or an OR? What if users have role1,
 role2, and *also* role 3? The patch assumes an OR, which might make sense
 if you are querying editor OR administrator, but not necessarily so for
 custom roles.

 I would think that AND is more obvious for an array passed to `role`. A
 `role__in` as an OR also fits similar patterns elsewhere, such as many
 vars in WP_Query.

 Sidenote: This going to be a fairly nasty meta query, at least until
 #10201 is ever tackled. If we do this API enhancement, let's not trumpet
 it too loudly. :-)

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


More information about the wp-trac mailing list