Make WordPress Core

Changeset 12267


Ignore:
Timestamp:
11/23/2009 09:04:11 PM (17 years ago)
Author:
ryan
Message:

Standardize on user_id instead of user_ID when passing comment data. fixes #11222

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-comments-post.php

    r12148 r12267  
    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 );
  • trunk/wp-includes/comment.php

    r12254 r12267  
    10771077 */
    10781078function wp_filter_comment($commentdata) {
    1079         $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
     1079        // user_id is preferred. user_ID is accepted for back-compat.
     1080        if ( isset($commentdata['user_ID']) )
     1081                $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_ID']);
     1082        else
     1083                $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_id']);
    10801084        $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
    10811085        $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
    … …  
    11281132
    11291133        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
    1130         $commentdata['user_ID']         = (int) $commentdata['user_ID'];
     1134        // user_id is preferred. user_ID is accepted for back-compat.
     1135        if ( isset($commentdata['user_ID']) )
     1136                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
     1137        else
     1138                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_id'];
    11311139
    11321140        $commentdata['comment_parent'] = absint($commentdata['comment_parent']);
    … …  
    11541162                $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
    11551163
    1156                 if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
     1164                if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_id'] )
    11571165                        wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
    11581166        }
  • trunk/wp-includes/user.php

    r11978 r12267  
    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 )
    … …  
    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;
Note: See TracChangeset for help on using the changeset viewer.