From 389f385701c7c427ff292b8aa49753dd2f6c5eb0 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 8 Nov 2011 08:18:36 +0000 Subject: [PATCH] * notification: do not notify expired or inactive users --- notifications/inc/class.notifications.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/notifications/inc/class.notifications.inc.php b/notifications/inc/class.notifications.inc.php index e4adb9017e..3b2a0e3ec5 100644 --- a/notifications/inc/class.notifications.inc.php +++ b/notifications/inc/class.notifications.inc.php @@ -367,7 +367,16 @@ final class notifications { try { // system or non-system user if($receiver->account_id && is_numeric($receiver->account_id)) { - // system user + // system user, collect data and check for Status and expire state, skip notification if expired or not active + $userData = $GLOBALS['egw']->accounts->read($receiver->account_id); + //error_log(__METHOD__.__LINE__." fetched data for User:".array2string($userData['account_lid']).'#'.$userData['account_type'].'#'.$userData['account_status'].'#'.$GLOBALS['egw']->accounts->is_expired($userData).'#'); + if ($userData && $userData['account_type'] === 'u' && + ($userData['account_status'] != 'A' || $GLOBALS['egw']->accounts->is_expired($userData))) + { + //error_log(__METHOD__.__LINE__." skipped notification for User with Data:".array2string($userData)); + $notification_chain = 'disable'; + continue; + } $receiver->handle = $receiver->account_lid; // check if the receiver has rights to run the notifcation app $ids = $GLOBALS['egw']->accounts->memberships($receiver->account_id,true);