From: Joshua Rüsweg Date: Thu, 1 May 2014 14:28:05 +0000 (+0200) Subject: add method "removeFromGroups()" X-Git-Tag: 2.1.0_Alpha_1~548^2~7^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fe6d199cad7996d95bca0070c69f53eb1284047f;p=GitHub%2FWoltLab%2FWCF.git add method "removeFromGroups()" As it's not currently with the action can only add users to groups, but can not remove it again, I would propose to add this method in order to create a proper opportunity to remove user from user groups. --- diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index 4e61f3c91c..cc23dce4e4 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -329,6 +329,35 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio } } + /** + * Add users to given groups. + */ + public function removeFromGroups() { + if (empty($this->objects)) { + $this->readObjects(); + } + + $groupIDs = $this->parameters['groups']; + + foreach ($this->objects as $userEditor) { + $userEditor->removeFromGroups($groupIDs); + } + + //reread objects + $this->objects = array(); + UserEditor::resetCache(); + $this->readObjects(); + + if (MODULE_USER_RANK) { + $action = new UserProfileAction($this->objects, 'updateUserRank'); + $action->executeAction(); + } + if (MODULE_USERS_ONLINE) { + $action = new UserProfileAction($this->objects, 'updateUserOnlineMarking'); + $action->executeAction(); + } + } + /** * Add users to given groups. */