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();
$action = $this->parameters['action'] ?? '';
$uid = $this->parameters['uid'] ?? 0;
$action = (string) $this->parameters['action'] ?? '';
$uid = (int) $this->parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
if (!$user) {
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');
}
switch ($action) {

View file

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

View file

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