Commit cfabff21ec3ea5603f3cce89885db00d9443d9df
1 parent
dca7b966
Email not sent to Disabled Group Users
Committed by: Jarrett Jordaan Reviewed by: Paul Barrett
Showing
1 changed file
with
9 additions
and
4 deletions
lib/groups/Group.inc
| ... | ... | @@ -163,13 +163,16 @@ class Group extends KTEntity { |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * Returns an array of Users in this group. |
| 166 | + * | |
| 167 | + * @param Boolean Return Disabled Users or Not (defaults false) | |
| 168 | + * | |
| 166 | 169 | */ |
| 167 | - function &getUsers() { | |
| 170 | + function &getUsers($disabled = false) { | |
| 168 | 171 | // legacy api. |
| 169 | - return $this->getMembers(); | |
| 172 | + return $this->getMembers($disabled); | |
| 170 | 173 | } |
| 171 | 174 | |
| 172 | - function &getMembers() { | |
| 175 | + function &getMembers($disabled = false) { | |
| 173 | 176 | global $default; |
| 174 | 177 | require_once(KT_LIB_DIR . '/users/User.inc'); |
| 175 | 178 | $sQuery = "SELECT user_id FROM $default->users_groups_table WHERE group_id = ?"; |
| ... | ... | @@ -178,10 +181,12 @@ class Group extends KTEntity { |
| 178 | 181 | $aMembers = array(); |
| 179 | 182 | foreach ($aUserIds as $iUserId) { |
| 180 | 183 | $oUser = User::get($iUserId); |
| 181 | - if ((!PEAR::isError($oUser)) && ($oUser !== false)) { | |
| 184 | + $is_disabled = ($disabled) ? false : $oUser->getDisabled(); | |
| 185 | + if ((!PEAR::isError($oUser)) && ($oUser !== false) && !$is_disabled) { | |
| 182 | 186 | $aMembers[] = $oUser; |
| 183 | 187 | } |
| 184 | 188 | } |
| 189 | + | |
| 185 | 190 | return $aMembers; |
| 186 | 191 | } |
| 187 | 192 | ... | ... |