Make WordPress Core

Ticket #44510: user.2.diff

File user.2.diff, 533 bytes (added by krynes, 6 years ago)

I think this is solution

  • user.php

     
    362362function count_user_posts( $userid, $post_type = 'post', $public_only = false ) {
    363363        global $wpdb;
    364364
     365        if( $userid === NULL AND is_user_logged_in() ){
     366                $userid = get_current_user_id();
     367        } else {
     368                return 0;
     369        }
     370
    365371        $where = get_posts_by_author_sql( $post_type, true, $userid, $public_only );
    366372
    367373        $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );