WordPress.org

Make WordPress Core

Ticket #11222: 11222.diff

File 11222.diff, 3.6 KB (added by ryan, 4 years ago)
  • wp-comments-post.php

     
    7575 
    7676$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; 
    7777 
    78 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 
     78$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_id'); 
    7979 
    8080$comment_id = wp_new_comment( $commentdata ); 
    8181 
  • wp-includes/comment.php

     
    10761076 * @return array Parsed comment information. 
    10771077 */ 
    10781078function wp_filter_comment($commentdata) { 
    1079         $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']); 
     1079        if ( isset($commentdata['user_ID']) ) 
     1080                $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_ID']); 
     1081        else 
     1082                $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_id']); 
    10801083        $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']); 
    10811084        $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']); 
    10821085        $commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']); 
     
    11271130        $commentdata = apply_filters('preprocess_comment', $commentdata); 
    11281131 
    11291132        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID']; 
    1130         $commentdata['user_ID']         = (int) $commentdata['user_ID']; 
     1133        if ( isset($commentdata['user_ID']) ) 
     1134                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID']; 
     1135        else 
     1136                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_id']; 
    11311137 
    11321138        $commentdata['comment_parent'] = absint($commentdata['comment_parent']); 
    11331139        $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : ''; 
     
    11531159 
    11541160                $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment 
    11551161 
    1156                 if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] ) 
     1162                if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_id'] ) 
    11571163                        wp_notify_postauthor($comment_ID, $commentdata['comment_type']); 
    11581164        } 
    11591165 
  • wp-includes/user.php

     
    451451 * @param int $user_id Optional. User ID to setup global data. 
    452452 */ 
    453453function setup_userdata($user_id = '') { 
    454         global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; 
     454        global $user_login, $userdata, $user_level, $user_id, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; 
    455455 
    456456        if ( '' == $user_id ) 
    457457                $user = wp_get_current_user(); 
     
    464464        $userdata = $user->data; 
    465465        $user_login     = $user->user_login; 
    466466        $user_level     = (int) isset($user->user_level) ? $user->user_level : 0; 
    467         $user_ID        = (int) $user->ID; 
     467        $user_id = $user_ID = (int) $user->ID; 
    468468        $user_email     = $user->user_email; 
    469469        $user_url       = $user->user_url; 
    470470        $user_pass_md5  = md5($user->user_pass);