[wp-trac] [WordPress Trac] #16556: Search exact role name

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 14 05:14:12 UTC 2011


#16556: Search exact role name
----------------------------+-----------------------------
 Reporter:  082net          |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  3.0.5
 Severity:  normal          |   Keywords:  has-patch
----------------------------+-----------------------------
 I've added 'system-author' role and now on Admin > Users page 'author'
 includes users in 'system-author' role.

 When wordpress search users in author role, it applied
 {{{
 " meta_value LIKE '%author%' "
 }}}
 and the result includes 'system-author' also.

 This can be fixed with adding double quote(") to role name:
 {{{
 " meta_value LIKE '%\"author\"%' "
 }}}

 We can fix this issue
 1. WP_User_Search::prepare_query() from /wp-admin/includes/user.php:689
 {{{
                         $this->query_where .= $wpdb->prepare(" AND
 $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND
 $wpdb->usermeta.meta_value LIKE %s", '%"' . $this->role . '"%');
 }}}
 2. count_users() from /wp-includes/user.php:459
 {{{
                         $select_count[] = "COUNT(NULLIF(`meta_value` LIKE
 '%\"" . like_escape($this_role) . "\"%', FALSE))";
 }}}

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


More information about the wp-trac mailing list