Improve search for user in Modration module

This commit is contained in:
Art4 2024-11-18 08:09:59 +00:00
parent 3d97280f52
commit 78444ff25c
3 changed files with 33 additions and 24 deletions

View file

@ -48,15 +48,18 @@ class Active extends BaseUsers
{ {
parent::content(); parent::content();
$action = $this->parameters['action'] ?? ''; $action = (string) $this->parameters['action'] ?? '';
$uid = $this->parameters['uid'] ?? 0; $uid = (int) $this->parameters['uid'] ?? 0;
if ($uid) { if ($uid === 0) {
$user = User::getById($uid, ['username', 'blocked']); $this->systemMessages->addNotice($this->t('User not found'));
if (!$user) { $this->baseUrl->redirect('moderation/users');
$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');
} }
switch ($action) { switch ($action) {

View file

@ -48,15 +48,18 @@ class Blocked extends BaseUsers
{ {
parent::content(); parent::content();
$action = $this->parameters['action'] ?? ''; $action = (string) $this->parameters['action'] ?? '';
$uid = $this->parameters['uid'] ?? 0; $uid = (int) $this->parameters['uid'] ?? 0;
if ($uid) { if ($uid === 0) {
$user = User::getById($uid, ['username', 'blocked']); $this->systemMessages->addNotice($this->t('User not found'));
if (!$user) { $this->baseUrl->redirect('moderation/users');
$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');
} }
switch ($action) { switch ($action) {

View file

@ -55,15 +55,18 @@ class Index extends BaseUsers
{ {
parent::content(); parent::content();
$action = $this->parameters['action'] ?? ''; $action = (string) $this->parameters['action'] ?? '';
$uid = $this->parameters['uid'] ?? 0; $uid = (int) $this->parameters['uid'] ?? 0;
if ($uid) { if ($uid === 0) {
$user = User::getById($uid, ['username', 'blocked']); $this->systemMessages->addNotice($this->t('User not found'));
if (!$user) { $this->baseUrl->redirect('moderation/users');
$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');
} }
switch ($action) { switch ($action) {