$userEditor->addToLanguages($languageIDs);
}
}
+
+ // handle user rename
+ if (count($this->objects) == 1 && !empty($this->parameters['data']['username'])) {
+ if ($this->objects[0]->username != $this->parameters['data']['username']) {
+ $userID = $this->objects[0]->userID;
+ $username = $this->parameters['data']['username'];
+
+ WCF::getDB()->beginTransaction();
+
+ // update comments
+ $sql = "UPDATE wcf".WCF_N."_comment
+ SET username = ?
+ WHERE userID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($username, $userID));
+
+ $sql = "UPDATE wcf".WCF_N."_comment_response
+ SET username = ?
+ WHERE userID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($username, $userID));
+
+ // modification log
+ $sql = "UPDATE wcf".WCF_N."_modification_log
+ SET username = ?
+ WHERE userID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($username, $userID));
+
+ WCF::getDB()->commitTransaction();
+
+ // fire event to handle other database tables
+ EventHandler::getInstance()->fireAction($this, 'rename');
+ }
+ }
}
+ /**
+ * Remove users from 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.
*/