}
foreach ($usersToGroup as $groupID => $users) {
- $userAction = new UserAction(array_unique($users), 'addToGroups', [
- 'addDefaultGroups' => false,
- 'deleteOldGroups' => false,
- 'groups' => [$groupID]
- ]);
- $userAction->executeAction();
+ if (!empty($users)) {
- $userAction = new UserAction(array_unique($users), 'addToGroups', array(
++ $userAction = new UserAction(array_unique($users), 'addToGroups', [
+ 'addDefaultGroups' => false,
+ 'deleteOldGroups' => false,
- 'groups' => array($groupID)
- ));
++ 'groups' => [$groupID]
++ ]);
+ $userAction->executeAction();
+ }
}
}
}