From fe6d199cad7996d95bca0070c69f53eb1284047f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Thu, 1 May 2014 16:28:05 +0200 Subject: [PATCH] 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. --- .../files/lib/data/user/UserAction.class.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) 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. */ -- 2.20.1