From b9704ad28b0f1e3062f5523a9c45e8746a252157 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 1 Oct 2024 12:08:52 +0300 Subject: [PATCH] * fixed $force arguments and not existed user; --- includes/common/class-users.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/includes/common/class-users.php b/includes/common/class-users.php index ef97d5a1..4bde40df 100644 --- a/includes/common/class-users.php +++ b/includes/common/class-users.php @@ -329,9 +329,13 @@ class Users { * @return bool */ public function can_activation_send( $user_id, $force = false ) { + if ( ! self::user_exists( $user_id ) ) { + return false; + } + if ( ! $force ) { $current_user_id = get_current_user_id(); - if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) { + if ( $current_user_id === $user_id ) { return false; } } @@ -548,9 +552,13 @@ class Users { * @return bool */ public function can_be_set_as_pending( $user_id, $force = false ) { + if ( ! self::user_exists( $user_id ) ) { + return false; + } + if ( ! $force ) { $current_user_id = get_current_user_id(); - if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) { + if ( $current_user_id === $user_id ) { return false; } } @@ -622,9 +630,13 @@ class Users { * @return bool */ public function can_be_approved( $user_id, $force = false ) { + if ( ! self::user_exists( $user_id ) ) { + return false; + } + if ( ! $force ) { $current_user_id = get_current_user_id(); - if ( $current_user_id === $user_id || ! self::user_exists( $user_id ) ) { + if ( $current_user_id === $user_id ) { return false; } }