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

WordPress Trac wp-trac at lists.automattic.com
Fri May 27 03:30:09 UTC 2011


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

Comment (by scribu):

 With that patch, you could do something like this:

 {{{
 add_action( 'pre_user_query', function( $user_query ) {
   $user_query->query_fields = 'SQL_CALC_FOUND_ROWS DISTINCT ' .
 $user_query->query_fields;
 } );

 add_filter( 'found_users_query', function( $sql ) {
   return 'SELECT FOUND_ROWS()';
 } );
 }}}

 Obviously, a 'distinct' arg for WP_User_Query that takes care of this
 would be better.

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


More information about the wp-trac mailing list