WordPress.org

Make WordPress Core

Ticket #10629: user.patch

File user.patch, 791 bytes (added by novasource, 9 years ago)
  • /wordpress/wp-includes/

    old new  
    174174}
    175175
    176176/**
     177 * Number of approved comments the user has written.
     178 *
     179 * @since 2.84
     180 * @uses $wpdb WordPress database object for queries.
     181 *
     182 * @param int $userid User ID.
     183 * @return int Amount of approved comments user has written.
     184 */
     185function get_usernumcomments($userid) {
     186        global $wpdb;
     187        $userid = (int) $userid;
     188        $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1'", $userid));
     189        return apply_filters('get_usernumcomments', $count, $userid);
     190}
     191
     192/**
    177193 * Check that the user login name and password is correct.
    178194 *
    179195 * @since 0.71