diff --git a/src/Navigation/Notifications/Repository/Notify.php b/src/Navigation/Notifications/Repository/Notify.php index 52c51fcb8e..683725e4ba 100644 --- a/src/Navigation/Notifications/Repository/Notify.php +++ b/src/Navigation/Notifications/Repository/Notify.php @@ -230,7 +230,7 @@ class Notify extends BaseRepository } // Ensure that the important fields are set at any time - $fields = ['nickname', 'account-type', 'notify-flags', 'language', 'username', 'email']; + $fields = ['nickname', 'account-type', 'notify-flags', 'language', 'username', 'email', 'account_removed', 'account_expired']; $user = DBA::selectFirst('user', $fields, ['uid' => $params['uid']]); if (!DBA::isResult($user)) { @@ -238,6 +238,10 @@ class Notify extends BaseRepository return false; } + if ($user['account_removed'] || $user['account_expired']) { + return false; + } + // There is no need to create notifications for forum accounts if ($user['account-type'] == Model\User::ACCOUNT_TYPE_COMMUNITY) { return false; @@ -503,7 +507,7 @@ class Notify extends BaseRepository $tsitelink = sprintf($sitelink, $params['link']); $hsitelink = sprintf($sitelink, '' . $sitename . '

'); break; - + case 'SYSTEM_DB_UPDATE_FAIL': // @TODO Unused (only here) break; } @@ -525,8 +529,11 @@ class Notify extends BaseRepository $parent_uri_id = $params['item']['parent-uri-id'] ?? null; // Ensure that the important fields are set at any time - $fields = ['nickname']; + $fields = ['nickname', 'account_removed', 'account_expired']; $user = Model\User::getById($params['uid'], $fields); + if ($user['account_removed'] || $user['user_expired']) { + return false; + } $sitename = $this->config->get('config', 'sitename'); @@ -711,6 +718,9 @@ class Notify extends BaseRepository $params['otype'] = Model\Notification\ObjectType::ITEM; $user = Model\User::getById($Notification->uid); + if ($user['account_removed'] || $user['account_expired']) { + return false; + } $params['notify_flags'] = $user['notify-flags']; $params['language'] = $user['language'];