mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
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:
parent
595ade87f9
commit
8951e37f8f
@ -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 {
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user