From: Tim Düsterhus Date: Sun, 19 Apr 2015 20:40:30 +0000 (+0200) Subject: Disable email notifications for disabled / banned users X-Git-Tag: 2.1.4~64^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2aaeadbe06cfe9c8299ff9161f09a915db139477;p=GitHub%2FWoltLab%2FWCF.git Disable email notifications for disabled / banned users - A user being disabled usually means that his email is not yet verified by proper double opt-in. - A banned user has no means of changing his notification settings. In both cases emails may have increased odds of being moved into the Junk folder by the recipient and as a consequence hurting the reputation of the sending mail server. see 0290c038a0f12431d0adeaf803cdd44d06fc086f --- diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php index ba6bf173f5..2cf66e3461 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php @@ -140,6 +140,10 @@ class DailyMailNotificationCronjob extends AbstractCronjob { if (!isset($users[$userID])) continue; $user = $users[$userID]; + // no notifications for disabled or banned users + if ($user->activationCode) continue; + if ($user->banned) continue; + // add mail header $message = $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.header', array( 'user' => $user diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 945426fa1a..f7fc6f291e 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -617,6 +617,10 @@ class UserNotificationHandler extends SingletonFactory { * @param \wcf\system\user\notification\event\IUserNotificationEvent $event */ public function sendInstantMailNotification(UserNotification $notification, User $user, IUserNotificationEvent $event) { + // no notifications for disabled or banned users + if ($user->activationCode) return; + if ($user->banned) return; + // recipient's language $event->setLanguage($user->getLanguage());