From 2012eca5c261751bb91c59f2524b92aa5ea5afe8 Mon Sep 17 00:00:00 2001 From: goldenapples Date: Thu, 20 Apr 2023 12:54:09 -0400 Subject: [PATCH] Get comment author from the comment user_id field Updates the get_comment_author function to retrieve the comment author ID from the "user_id" field of the comment rather than assuming the current user is the author of the comment. --- connectors/class-connector-comments.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connectors/class-connector-comments.php b/connectors/class-connector-comments.php index fe7f16ba4..95ce1fa5e 100644 --- a/connectors/class-connector-comments.php +++ b/connectors/class-connector-comments.php @@ -194,8 +194,8 @@ public function get_comment_author( $comment, $field = 'id' ) { $user_name = isset( $user->display_name ) ? $user->display_name : $comment->comment_author; } - if ( $req_user_login ) { - $user = wp_get_current_user(); + if ( $req_user_login && isset( $comment->user_id ) ) { + $user = get_user_by( 'id', $comment->user_id ); $user_id = $user->ID; $user_name = $user->display_name; }