diff --git a/wp-comments-post.php b/wp-comments-post.php index 8fa0548991..923b03b99c 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -75,7 +75,7 @@ if ( '' == $comment_content ) $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; -$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_id'); +$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); $comment_id = wp_new_comment( $commentdata ); diff --git a/wp-includes/comment.php b/wp-includes/comment.php index cdf6ae249d..4a3615ef6d 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1126,11 +1126,10 @@ function wp_insert_comment($commentdata) { * @return array Parsed comment information. */ function wp_filter_comment($commentdata) { - // user_id is preferred. user_ID is accepted for back-compat. if ( isset($commentdata['user_ID']) ) - $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_ID']); - else - $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_id']); + $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']); + elseif ( isset($commentdata['user_id']) ) + $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']); $commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']); $commentdata['comment_author'] = apply_filters('pre_comment_author_name', $commentdata['comment_author']); $commentdata['comment_content'] = apply_filters('pre_comment_content', $commentdata['comment_content']); @@ -1181,11 +1180,10 @@ function wp_new_comment( $commentdata ) { $commentdata = apply_filters('preprocess_comment', $commentdata); $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID']; - // user_id is preferred. user_ID is accepted for back-compat. if ( isset($commentdata['user_ID']) ) $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID']; - else - $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_id']; + elseif ( isset($commentdata['user_id']) ) + $commentdata['user_id'] = (int) $commentdata['user_id']; $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0; $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : ''; diff --git a/wp-includes/user.php b/wp-includes/user.php index 120ec65ada..749558895d 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -451,7 +451,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) { * @param int $for_user_id Optional. User ID to setup global data. */ function setup_userdata($for_user_id = '') { - global $user_login, $userdata, $user_level, $user_id, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; + global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; if ( '' == $for_user_id ) $user = wp_get_current_user(); @@ -464,7 +464,7 @@ function setup_userdata($for_user_id = '') { $userdata = $user->data; $user_login = $user->user_login; $user_level = (int) isset($user->user_level) ? $user->user_level : 0; - $user_id = $user_ID = (int) $user->ID; + $user_ID = (int) $user->ID; $user_email = $user->user_email; $user_url = $user->user_url; $user_pass_md5 = md5($user->user_pass);