From 4654420d7b1813d4c1b730d513e9a413dae9dc2b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 4 Sep 2012 11:51:31 +0200 Subject: [PATCH] Should fix bug when sending announcements see #5394 --- main/announcements/announcement_email.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/main/announcements/announcement_email.class.php b/main/announcements/announcement_email.class.php index e68d856358..1eba1181c1 100644 --- a/main/announcements/announcement_email.class.php +++ b/main/announcements/announcement_email.class.php @@ -148,14 +148,19 @@ class AnnouncementEmail if ($users) { $users = UserManager::get_user_list_by_ids($users, true); - } else { - $users = self::all_users(); - } + } if (!empty($groups)) { $group_users = GroupManager::get_groups_users($groups); $group_users = UserManager::get_user_list_by_ids($group_users, true); - $users = array_merge($users, $group_users); + + if (!empty($group_users)) { + $users = array_merge($users, $group_users); + } + } + + if (empty($users)) { + $users = self::all_users(); } //Clean users just in case @@ -164,7 +169,7 @@ class AnnouncementEmail foreach ($users as $user) { $new_list_users[$user['user_id']] = array('user_id' => $user['user_id']); } - } + } return $new_list_users; }