return $user;
}
+
+ /**
+ * @see wcf\data\AbstractDatabaseObjectAction::update()
+ */
+ public function update() {
+ parent::update();
+
+ $groupIDs = (isset($this->parameters['groups'])) ? $this->parameters['groups'] : array();
+ $removeGroups = (isset($this->parameters['removeGroups'])) ? $this->parameters['removeGroups'] : array();
+
+ foreach ($this->objects as $userEditor) {
+ if (count($groupIDs)) {
+ $userEditor->addToGroups($groupIDs, false, false);
+ }
+
+ if (count($removeGroups)) {
+ $userEditor->removeFromGroups($removeGroups);
+ }
+ }
+ }
}
$statement->execute(array($this->userID, $groupID));
}
+ /**
+ * Removes a user from multiple user groups.
+ *
+ * @param array $groupIDs
+ */
+ public function removeFromGroups(array $groupIDs) {
+ $sql = "DELETE FROM wcf".WCF_N."_user_to_group
+ WHERE userID = ?
+ AND groupID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ foreach ($groupIDs as $groupID) {
+ $statement->execute(array(
+ $this->userID,
+ $groupID
+ ));
+ }
+ }
+
/**
* Saves the visible languages of a user.
*