PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | json-endpoints/class.wpcom-json-api-update-comment-endpoint.php +10 -0 13.3.316.3-a.1 View file →
@@ -10,8 +10,12 @@
10 10 */
11 11
12 12 use Automattic\Jetpack\Status;
13 13
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit( 0 );
16 +}
17 +
14 18 new WPCOM_JSON_API_Update_Comment_Endpoint(
15 19 array(
16 20 'description' => 'Create a comment on a post.',
17 21 'group' => 'comments',
@@ -147,8 +151,10 @@
147 151 );
148 152
149 153 /**
150 154 * Update comments endpoint class.
155 + *
156 + * @phan-constructor-used-for-side-effects
151 157 */
152 158 class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endpoint {
153 159 /**
154 160 * WPCOM_JSON_API_Update_Comment_Endpoint constructor.
@@ -308,8 +314,12 @@
308 314 'comment_content' => $input['content'],
309 315 'comment_parent' => $comment_parent_id,
310 316 'comment_type' => 'comment',
311 317 );
318 +
319 + if ( ! empty( $this->api->token_details['user']['user_ip'] ) && filter_var( $this->api->token_details['user']['user_ip'], FILTER_VALIDATE_IP ) ) {
320 + $insert['comment_author_IP'] = $this->api->token_details['user']['user_ip'];
321 + }
312 322
313 323 if ( $comment_parent_id ) {
314 324 if ( '0' === $comment_parent->comment_approved && current_user_can( 'edit_comment', $comment_parent->comment_ID ) ) {
315 325 wp_set_comment_status( $comment_parent->comment_ID, 'approve' );