diff --git a/src/Module/Moderation/Users/Active.php b/src/Module/Moderation/Users/Active.php index b16efa46ae..f25bb40ed2 100644 --- a/src/Module/Moderation/Users/Active.php +++ b/src/Module/Moderation/Users/Active.php @@ -51,15 +51,12 @@ class Active extends BaseUsers $action = (string) $this->parameters['action'] ?? ''; $uid = (int) $this->parameters['uid'] ?? 0; - if ($uid === 0) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); - } - - $user = User::getById($uid, ['username', 'blocked']); - if (!is_array($user)) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + if ($uid !== 0) { + $user = User::getById($uid, ['username', 'blocked']); + if (!$user) { + $this->systemMessages->addNotice($this->t('User not found')); + $this->baseUrl->redirect('moderation/users'); + } } switch ($action) { diff --git a/src/Module/Moderation/Users/Blocked.php b/src/Module/Moderation/Users/Blocked.php index 6eeb11549f..6d4d1cce16 100644 --- a/src/Module/Moderation/Users/Blocked.php +++ b/src/Module/Moderation/Users/Blocked.php @@ -51,15 +51,12 @@ class Blocked extends BaseUsers $action = (string) $this->parameters['action'] ?? ''; $uid = (int) $this->parameters['uid'] ?? 0; - if ($uid === 0) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); - } - - $user = User::getById($uid, ['username', 'blocked']); - if (!is_array($user)) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + if ($uid !== 0) { + $user = User::getById($uid, ['username', 'blocked']); + if (!$user) { + $this->systemMessages->addNotice($this->t('User not found')); + $this->baseUrl->redirect('moderation/users'); + } } switch ($action) { diff --git a/src/Module/Moderation/Users/Index.php b/src/Module/Moderation/Users/Index.php index 1a7d8f1721..61208d3403 100644 --- a/src/Module/Moderation/Users/Index.php +++ b/src/Module/Moderation/Users/Index.php @@ -58,15 +58,12 @@ class Index extends BaseUsers $action = (string) $this->parameters['action'] ?? ''; $uid = (int) $this->parameters['uid'] ?? 0; - if ($uid === 0) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); - } - - $user = User::getById($uid, ['username', 'blocked']); - if (!is_array($user)) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + if ($uid !== 0) { + $user = User::getById($uid, ['username', 'blocked']); + if (!$user) { + $this->systemMessages->addNotice($this->t('User not found')); + $this->baseUrl->redirect('moderation/users'); + } } switch ($action) {