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