Make WordPress Core

Ticket #21364: 21364.2.diff

File 21364.2.diff, 898 bytes (added by Caspie, 12 years ago)

also pass to filter

  • wp-includes/user.php

     
    148148 * @uses $wpdb WordPress database object for queries.
    149149 *
    150150 * @param int $userid User ID.
     151 * @param string|array $post_type Optional. Post type to check. Defaults to post.
    151152 * @return int Amount of posts user has written.
    152153 */
    153 function count_user_posts($userid) {
     154function count_user_posts( $userid, $post_type = 'post' ) {
    154155        global $wpdb;
    155156
    156         $where = get_posts_by_author_sql('post', true, $userid);
     157        $where = get_posts_by_author_sql( $post_type, true, $userid );
    157158
    158159        $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
    159160
    160         return apply_filters('get_usernumposts', $count, $userid);
     161        return apply_filters( 'get_usernumposts', $count, $userid, $post_type );
    161162}
    162163
    163164/**