Make WordPress Core

Ticket #17025: 17025.diff

File 17025.diff, 929 bytes (added by wonderboymusic, 11 years ago)
  • wp-includes/author-template.php

    diff --git wp-includes/author-template.php wp-includes/author-template.php
    index 2a89498..7d2d782 100644
    function wp_list_authors($args = '') { 
    283283        $query_args['fields'] = 'ids';
    284284        $authors = get_users( $query_args );
    285285
     286        $sql = "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author";
     287        $rows = $wpdb->get_results( apply_filters( 'list_authors_query', $sql ) );
     288
    286289        $author_count = array();
    287         foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row )
     290        foreach ( (array) $rows as $row )
    288291                $author_count[$row->post_author] = $row->count;
    289292
    290293        foreach ( $authors as $author_id ) {