Ensure the count for users with no role remains accurate when users with multiple roles are present.

See #34495

Built from https://develop.svn.wordpress.org/trunk@35707


git-svn-id: http://core.svn.wordpress.org/trunk@35671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-11-19 17:11:25 +00:00
parent 595ade87f9
commit 8951e37f8f
2 changed files with 4 additions and 3 deletions

View File

@ -758,6 +758,7 @@ function count_users($strategy = 'time') {
foreach ( $avail_roles as $this_role => $name ) {
$select_count[] = $wpdb->prepare( "COUNT(NULLIF(`meta_value` LIKE %s, false))", '%' . $wpdb->esc_like( '"' . $this_role . '"' ) . '%');
}
$select_count[] = "COUNT(NULLIF(`meta_value` = 'a:0:{}', false))";
$select_count = implode(', ', $select_count);
// Add the meta_value index to the selection list, then run the query.
@ -773,11 +774,11 @@ function count_users($strategy = 'time') {
}
}
$role_counts['none'] = (int) $row[$col++];
// Get the meta_value index from the end of the result set.
$total_users = (int) $row[$col];
$role_counts['none'] = ( $total_users - array_sum( $role_counts ) );
$result['total_users'] = $total_users;
$result['avail_roles'] =& $role_counts;
} else {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-beta4-35706';
$wp_version = '4.4-beta4-35707';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.