[wp-trac] [WordPress Trac] #23849: Unexepected results when running WP_User_Query with role and meta_query

WordPress Trac noreply at wordpress.org
Fri Mar 22 20:30:36 UTC 2013


#23849: Unexepected results when running WP_User_Query with role and meta_query
--------------------------+------------------------------
 Reporter:  layotte       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |
--------------------------+------------------------------

Comment (by layotte):

 Oops, that SQL should be this:

 {{{

 SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_users.*
 FROM wp_users
 INNER JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id
 INNER JOIN wp_usermeta AS mt1 ON (wp_users.ID = mt1.user_id)
 INNER JOIN wp_usermeta AS mt2 ON (wp_users.ID = mt2.user_id)
 WHERE 1=1
 AND (wp_usermeta.meta_key = '_my_key'
         OR  (mt1.meta_key = '_my_key' AND CAST(mt1.meta_value AS CHAR) NOT
 LIKE '%off%')
         OR  (mt2.meta_key = 'wp_capabilities' AND CAST(mt2.meta_value AS
 CHAR) LIKE '%\"Author\"%') )
 ORDER BY user_login ASC LIMIT 100
 }}}

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


More information about the wp-trac mailing list