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));