From 58ff0647c9f6cce940ea22f79a0dff6c08a65b52 Mon Sep 17 00:00:00 2001 From: Mikhail Korsakov Date: Wed, 22 Sep 2021 12:30:01 +0700 Subject: [PATCH] BUGFIX SIO-3606 client email edit fix --- hooks.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hooks.php b/hooks.php index a923be1..4964553 100644 --- a/hooks.php +++ b/hooks.php @@ -55,6 +55,10 @@ try { $userId = null; + if (empty($params['email'])) { + return []; + } + // If updating user via admin area if (isset($params['userid'])) { $userId = $params['userid']; @@ -76,7 +80,7 @@ $serverParams = Servers::getValidParams(); if (empty($serverParams)) { - throw new Exception('No valid WHMCS server found'); + return []; } $userResource = new UserResource(Connector::create($serverParams)); @@ -94,10 +98,14 @@ add_hook('ClientEdit', 1, function(array $params) { try { + if (empty($params['email'])) { + return; + } + $serverParams = Servers::getValidParams(); if (empty($serverParams)) { - throw new Exception('No valid WHMCS server found'); + return; } $userResource = new UserResource(Connector::create($serverParams));