Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#17775 closed defect (bug) (fixed)

Possible invalid user roles count with similarly named roles

Reported by: layotte Owned by:
Milestone: 3.4 Priority: normal
Severity: minor Version: 3.1.3
Component: Users Keywords: has-patch
Focuses: Cc:


How to replicate: Create a user role named "custom_administrator", add users to this role. Role count in /wp-admin/users.php for the "Administrator" role will include the users in the "custom_administrator" role.

Currently line 852 of /wp-includes/users.php counts the roles with this line:

$select_count[] = "COUNT(NULLIF(`meta_value` LIKE '%" . like_escape($this_role) . "%', FALSE))";

Lines in DB look like this:


Patch for users.php attached, to this:

$select_count[] = "COUNT(NULLIF(`meta_value` LIKE '%\"" . like_escape($this_role) . "\"%', FALSE))";

Attachments (1)

users.php.patch (582 bytes) - added by layotte 9 years ago.

Download all attachments as: .zip

Change History (3)

9 years ago

#2 @coffee2code
8 years ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 3.4
  • Resolution set to fixed
  • Status changed from new to closed
  • Version set to 3.1.3

Fixed in [19735].

Note: See TracTickets for help on using tickets.