WordPress.org

Make WordPress Core

Ticket #29785: user_count_normalsite_multisite.patch

File user_count_normalsite_multisite.patch, 697 bytes (added by dots, 4 years ago)

Modified the select user query to fetch the proper user count in simple and the multisite network. Tested in simple and multisite network and it's working fine.

  • user.php

     
    854854                $select_count = implode(', ', $select_count);
    855855
    856856                // Add the meta_value index to the selection list, then run the query.
    857                 $row = $wpdb->get_row( "SELECT $select_count, COUNT(*) FROM $wpdb->usermeta WHERE meta_key = '{$blog_prefix}capabilities'", ARRAY_N );
     857                $row = $wpdb->get_row( "SELECT $select_count, COUNT(*) FROM {$wpdb->usermeta} JOIN {$wpdb->users} ON user_id = ID WHERE meta_key = '{$blog_prefix}capabilities'", ARRAY_N );
     858               
    858859
    859860                // Run the previous loop again to associate results with role names.
    860861                $col = 0;