[wp-trac] [WordPress Trac] #17582: Problems with duplicated users

WordPress Trac wp-trac at lists.automattic.com
Mon Jun 6 18:59:34 UTC 2011


#17582: Problems with duplicated users
--------------------------+------------------
 Reporter:  scribu        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.2
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------

Comment (by greuben):

 > Can $meta_query->get_sql() be made smart enough to know when DISTINCT is
 required and return a clause for it?

 Yes it is possible because DISTINCT is only required for OR'ed queries.

 There is one problem with using distinct. Consider two users with same
 display name and run this query.
 {{{
 new WP_User_Query( array(
                 'distinct' => true,
                 'fields' => array( 'display_name' ),
                 'meta_query' => array(
                         'relation' => 'OR',
                         array( 'key' => 'wp_capabilities' ),
                         array( 'key' => 'name' )
                 )
 ) )
 }}}

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


More information about the wp-trac mailing list