WordPress.org

Make WordPress Core

Ticket #15699: 15699.diff

File 15699.diff, 939 bytes (added by scribu, 7 years ago)

Avoind redundant call to count_many_users_posts()

  • wp-admin/includes/class-wp-users-list-table.php

     
    180180
    181181        function display_rows() {
    182182                // Query the post counts for this page
    183                 $post_counts = count_many_users_posts( array_keys( $this->items ) );
     183                if ( $this->is_site_users )
     184                        $post_counts = count_many_users_posts( array_keys( $this->items ) );
    184185
    185186                $style = '';
    186187                foreach ( $this->items as $userid => $user_object ) {
     
    190191                                continue;
    191192
    192193                        $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
    193                         echo "\n\t", $this->single_row( $user_object, $style, $role, $post_counts[ $userid ] );
     194                        echo "\n\t", $this->single_row( $user_object, $style, $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
    194195                }
    195196        }
    196197