[wp-trac] [WordPress Trac] #20135: WP_User_Query() search Bug

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 28 21:28:34 UTC 2012


#20135: WP_User_Query() search Bug
--------------------------+-----------------------------
 Reporter:  khoallaby     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:  3.3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 OP here ( http://wordpress.org/support/topic/wp_user_query-search-
 bug?replies=1 ), before i knew i could submit tickets to WP's trac.


 for example I run

 $query = new WP_User_Query( array( 'search' => 'sand' ) );

 and get no results returned unless I set 'sand' to the exact match, like
 'sandbox' (in my case).

 var_dump below. Specifically looking at the 'query_where', where it should
 be user_login LIKE '%sand%' with the ampersands to actually query LIKE
 terms.


 {{{
 object(WP_User_Query)#5 (8) {
   ["results"]=>
   array(0) {
   }
   ["total_users"]=>
   string(1) "0"
   ["query_fields"]=>
   string(30) "SQL_CALC_FOUND_ROWS wp_users.*"
   ["query_from"]=>
   string(13) "FROM wp_users"
   ["query_where"]=>
   string(67) "WHERE 1=1 AND (user_login LIKE 'sand' OR user_nicename LIKE
 'sand')"
   ["query_orderby"]=>
   string(23) "ORDER BY user_login ASC"
   ["query_limit"]=>
   NULL
   ["query_vars"]=>
   array(15) {
     ["blog_id"]=>
     int(1)
     ["role"]=>
     string(0) ""
     ["meta_key"]=>
     string(0) ""
     ["meta_value"]=>
     string(0) ""
     ["meta_compare"]=>
     string(0) ""
     ["include"]=>
     array(0) {
     }
     ["exclude"]=>
     array(0) {
     }
     ["search"]=>
     string(4) "sand"
     ["orderby"]=>
     string(5) "login"
     ["order"]=>
     string(3) "ASC"
     ["offset"]=>
     string(0) ""
     ["number"]=>
     string(0) ""
     ["count_total"]=>
     bool(true)
     ["fields"]=>
     string(3) "all"
     ["who"]=>
     string(0) ""
   }
 }

 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20135>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list