Opened 14 years ago
Closed 14 years ago
#16556 closed enhancement (duplicate)
Search exact role name
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0.5 |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
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
- 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 . '"%');
- count_users() from /wp-includes/user.php:459
$select_count[] = "COUNT(NULLIF(`meta_value` LIKE '%\"" . like_escape($this_role) . "\"%', FALSE))";
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
If #10201 gets done in 3.2, this'll be unneeded, On the other hand, If it doesnt, this seems like a sane patch.