Make WordPress Core

Ticket #29785: user_count.2.patch

File user_count.2.patch, 741 bytes (added by dots, 7 years ago)

Modified the select user query to fetch the proper user count and based on the blogged prefix select table 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 );
    858 
     857                $row = $wpdb->get_row( "SELECT $select_count, COUNT(*) FROM {$blog_prefix}usermeta JOIN {$blog_prefix}users ON user_id = ID WHERE meta_key = '{$blog_prefix}capabilities'", ARRAY_N );
     858               
     859               
    859860                // Run the previous loop again to associate results with role names.
    860861                $col = 0;
    861862                $role_counts = array();