From 8301763c662ac38b12cad843869326a30ce5543a Mon Sep 17 00:00:00 2001 From: Andrii Semenets Date: Thu, 5 Dec 2024 20:45:08 +0200 Subject: [PATCH] further update check_if_profilefield_applies() to have a correct response (#719) --- classes/booking_campaigns/campaigns_info.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/classes/booking_campaigns/campaigns_info.php b/classes/booking_campaigns/campaigns_info.php index 49afcb68e..9044be5ce 100644 --- a/classes/booking_campaigns/campaigns_info.php +++ b/classes/booking_campaigns/campaigns_info.php @@ -449,20 +449,23 @@ public static function check_if_profilefield_applies( } switch ($operator) { case "=": // Equals. - $blocking = $user->profile[$fieldname] === $field; + if ($blocking = $user->profile[$fieldname] === $field) { + return true; + } break; case "~": // Contains. - $blocking = strpos($user->profile[$fieldname], $field) !== false; + if ($blocking = strpos($user->profile[$fieldname], $field) !== false) { + return true; + } break; case "!~": // Does not contain. - $blocking = strpos($user->profile[$fieldname], $field) == false; + if (!$blocking = strpos($user->profile[$fieldname], $field) === false) { + return false; + } break; } $result = $blocking; - if ($result == true) { - break; - } } return $result; }