Fix user profile URL logic for comment authors

Previously, the profile URL was returned even when the user ID was empty. This change ensures the URL is only generated if the user ID is present, preventing potential errors.
This commit is contained in:
Mykyta Synelnikov
2025-10-07 11:56:25 +03:00
parent b8216dee2a
commit a33be50a55
+1 -1
View File
@@ -94,7 +94,7 @@ if ( ! class_exists( 'um\frontend\User_Profile' ) ) {
* @return string The user profile URL for the comment author.
*/
public function change_comment_author_url( $comment_author_url, $comment_id, $comment ) {
if ( ! is_null( $comment ) ) {
if ( ! is_null( $comment ) && ! empty( $comment->user_id ) ) {
return um_user_profile_url( $comment->user_id );
}