Ticket #38817: 38817.diff
File 38817.diff, 1.6 KB (added by , 9 years ago) |
---|
-
src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
class WP_REST_Comments_Controller extend 1029 1029 $prepared_comment['comment_author'] = $request['author_name']; 1030 1030 } 1031 1031 1032 1032 if ( isset( $request['author_email'] ) ) { 1033 1033 $prepared_comment['comment_author_email'] = $request['author_email']; 1034 1034 } 1035 1035 1036 1036 if ( isset( $request['author_url'] ) ) { 1037 1037 $prepared_comment['comment_author_url'] = $request['author_url']; 1038 1038 } 1039 1039 1040 1040 if ( isset( $request['author_ip'] ) ) { 1041 1041 $prepared_comment['comment_author_IP'] = $request['author_ip']; 1042 1042 } 1043 1043 1044 if ( isset( $request['author_user_agent'] ) ) {1044 if ( !empty( $request['author_user_agent'] ) ) { 1045 1045 $prepared_comment['comment_agent'] = $request['author_user_agent']; 1046 } elseif ( $request->get_header( 'user_agent' ) ) { 1047 $prepared_comment['comment_agent'] = $request->get_header( 'user_agent' ); 1046 1048 } 1047 1049 1048 1050 if ( isset( $request['type'] ) ) { 1049 1051 // Comment type "comment" needs to be created as an empty string. 1050 1052 $prepared_comment['comment_type'] = 'comment' === $request['type'] ? '' : $request['type']; 1051 1053 } 1052 1054 1053 1055 if ( isset( $request['karma'] ) ) { 1054 1056 $prepared_comment['comment_karma'] = $request['karma'] ; 1055 1057 } 1056 1058 1057 1059 if ( ! empty( $request['date'] ) ) { 1058 1060 $date_data = rest_get_date_with_gmt( $request['date'] ); 1059 1061 1060 1062 if ( ! empty( $date_data ) ) {