Ticket #10856: comment_fields.diff
| File comment_fields.diff, 2.9 KB (added by scribu, 4 years ago) |
|---|
-
wp-includes/comment.php
1012 1012 global $wpdb; 1013 1013 extract(stripslashes_deep($commentdata), EXTR_SKIP); 1014 1014 1015 if ( ! isset($comment_author_IP) )1016 $comment_author_IP = '';1017 1015 if ( ! isset($comment_date) ) 1018 1016 $comment_date = current_time('mysql'); 1019 1017 if ( ! isset($comment_date_gmt) ) … … 1022 1020 $comment_parent = 0; 1023 1021 if ( ! isset($comment_approved) ) 1024 1022 $comment_approved = 1; 1025 if ( ! isset($comment_karma) )1026 $comment_karma = 0;1027 1023 if ( ! isset($user_id) ) 1028 1024 $user_id = 0; 1029 1025 if ( ! isset($comment_type) ) 1030 1026 $comment_type = ''; 1031 1027 1032 $data = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_ author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id');1028 $data = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent', 'user_id'); 1033 1029 $wpdb->insert($wpdb->comments, $data); 1034 1030 1035 1031 $id = (int) $wpdb->insert_id; 1036 1032 1033 // Extra data 1034 foreach ( array('comment_author_IP', 'comment_agent', 'comment_karma') as $field ) 1035 if ( isset( $$field ) ) 1036 add_comment_meta($id, $field, $$field, true); 1037 1037 1038 if ( $comment_approved == 1 ) 1038 1039 wp_update_comment_count($comment_post_ID); 1039 1040 -
wp-includes/comment-template.php
169 169 * @return unknown 170 170 */ 171 171 function get_comment_author_IP() { 172 global $comment; 173 return apply_filters('get_comment_author_IP', $comment->comment_author_IP); 172 return apply_filters('get_comment_author_IP', get_comment_meta($comment->comment_ID, 'comment_author_IP', true)); 174 173 } 175 174 176 175 /** -
wp-admin/includes/schema.php
69 69 comment_author tinytext NOT NULL, 70 70 comment_author_email varchar(100) NOT NULL default '', 71 71 comment_author_url varchar(200) NOT NULL default '', 72 comment_author_IP varchar(100) NOT NULL default '',73 72 comment_date datetime NOT NULL default '0000-00-00 00:00:00', 74 73 comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 75 74 comment_content text NOT NULL, 76 comment_karma int(11) NOT NULL default '0',77 75 comment_approved varchar(20) NOT NULL default '1', 78 comment_agent varchar(255) NOT NULL default '',79 76 comment_type varchar(20) NOT NULL default '', 80 77 comment_parent bigint(20) unsigned NOT NULL default '0', 81 78 user_id bigint(20) unsigned NOT NULL default '0',
