Make WordPress Core


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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        }
Note: See TracChangeset for help on using the changeset viewer.