Make WordPress Core


Ignore:
Timestamp:
08/03/2012 01:06:05 AM (12 years ago)
Author:
nacin
Message:

Move most instances of new WP_User to get_userdata(). see #21120.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r21186 r21413  
    651651    do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );
    652652
    653     if ( isset($user_id) && $user_id) {
    654         $userdata = get_userdata($user_id);
    655         $user = new WP_User($user_id);
     653    if ( ! empty( $user_id ) ) {
     654        $user = get_userdata( $user_id );
    656655        $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));
    657656    }
    658657
    659     if ( isset($userdata) && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
     658    if ( $user && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
    660659        // The author and the admins get respect.
    661660        $approved = 1;
Note: See TracChangeset for help on using the changeset viewer.