Skip to content

Commit

Permalink
BUGFIX SIO-3606 client email edit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Korsakov committed Sep 22, 2021
1 parent 3797255 commit 58ff064
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit 58ff064

Please sign in to comment.