Skip to content

Commit dd6c99a

Browse files
committed
Save IP address with RSVP.
1 parent fe9d86c commit dd6c99a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

includes/core/classes/class-rsvp.php

+5
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,15 @@ public function save( int $user_id, string $status, int $anonymous = 0, int $gue
227227
$args = array(
228228
'comment_author_url' => get_author_posts_url( $user_id ),
229229
'comment_post_ID' => $post_id,
230+
'comment_author_IP' => '127.0.0.1',
230231
'comment_type' => self::COMMENT_TYPE,
231232
'user_id' => $user_id,
232233
);
233234

235+
if ( ! empty( $_SERVER['REMOTE_ADDR'] ) && rest_is_ip_address( $_SERVER['REMOTE_ADDR'] ) ) {
236+
$args['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
237+
}
238+
234239
if ( empty( $rsvp ) ) {
235240
$comment_id = wp_insert_comment( $args );
236241
} else {

0 commit comments

Comments
 (0)