[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
Sun Mar 24 17:14:20 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:  Awaiting Review
Component:  Users        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------
Changes (by scribu):

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


Comment:

 {{{
 $qv['meta_query']['relation'] = 'OR';
 }}}

 So, this won't work as expected:

 {{{
 $users = get_users( array(
   'role' => array( 'foo', 'bar' ),
   'meta_query' => array(
     'relation' => 'AND',
     array(
       'key' => 'some_other_key',
       'compare' => 'EXISTS'
     ),
     array(
       'key' => 'another_key',
       'compare' => 'EXISTS'
     )
   )
 ) );
 }}}

 OTOH, `'relation' => 'OR'` already doesn't work as expected when you pass
 any 'role' value.

 Maybe use a separate WP_Meta_Query instance for querying the roles and
 definitely add tests for both of these corner cases.

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


More information about the wp-trac mailing list