/** * Checks if the users with the given ids should be assigned to new user * groups. * * Note: This method uses the user ids as a parameter instead of user objects * on purpose to make sure the latest data of the users are fetched. * * @param array<integer> $userIDs */ public function checkUsers(array $userIDs) { if (empty($userIDs)) { return; } $userList = new UserList(); $userList->getConditionBuilder()->add('user_table.userID IN (?)', array($userIDs)); $userList->readObjects(); $assignments = UserGroupAssignmentCacheBuilder::getInstance()->getData(); foreach ($userList as $user) { $groupIDs = $user->getGroupIDs(); $newGroupIDs = array(); foreach ($assignments as $assignment) { if (in_array($assignment->groupID, $groupIDs) || in_array($assignment->groupID, $newGroupIDs)) { continue; } $checkFailed = false; $conditions = $assignment->getConditions(); foreach ($conditions as $condition) { if (!$condition->getObjectType()->getProcessor()->checkUser($condition, $user)) { $checkFailed = true; break; } } if (!$checkFailed) { $newGroupIDs[] = $assignment->groupID; } } if (!empty($newGroupIDs)) { $userAction = new UserAction(array($user), 'addToGroups', array('addDefaultGroups' => false, 'deleteOldGroups' => false, 'groups' => $newGroupIDs)); $userAction->executeAction(); } } }
/** * Sends a new password to the given user. * * @param \wcf\data\user\UserEditor $userEditor */ protected function sendNewPassword(UserEditor $userEditor) { $newPassword = PasswordUtil::getRandomPassword(REGISTER_PASSWORD_MIN_LENGTH > 12 ? REGISTER_PASSWORD_MIN_LENGTH : 12); $userAction = new UserAction(array($userEditor), 'update', array('data' => array('password' => $newPassword))); $userAction->executeAction(); // send mail $mail = new Mail(array($userEditor->username => $userEditor->email), $userEditor->getLanguage()->getDynamicVariable('wcf.acp.user.sendNewPassword.mail.subject'), $userEditor->getLanguage()->getDynamicVariable('wcf.acp.user.sendNewPassword.mail', array('password' => $newPassword, 'username' => $userEditor->username))); $mail->send(); }
/** * @see \wcf\system\cronjob\ICronjob::execute() */ public function execute(Cronjob $cronjob) { parent::execute($cronjob); $userIDs = array(); $sql = "SELECT\tuserID\n\t\t\tFROM\twcf" . WCF_N . "_user\n\t\t\tWHERE\tquitStarted > ?\n\t\t\t\tAND quitStarted < ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array(0, TIME_NOW - 7 * 24 * 3600)); while ($row = $statement->fetchArray()) { $userIDs[] = $row['userID']; } if (!empty($userIDs)) { $action = new UserAction($userIDs, 'delete'); $action->executeAction(); } }
/** * @see \wcf\system\cronjob\ICronjob::execute() */ public function execute(Cronjob $cronjob) { parent::execute($cronjob); $assignments = UserGroupAssignmentCacheBuilder::getInstance()->getData(); $usersToGroup = array(); foreach ($assignments as $assignment) { if (!isset($usersToGroup[$assignment->groupID])) { $usersToGroup[$assignment->groupID] = array(); } $usersToGroup[$assignment->groupID] = array_merge($usersToGroup[$assignment->groupID], UserGroupAssignmentHandler::getInstance()->getUsers($assignment)); } foreach ($usersToGroup as $groupID => $users) { $userAction = new UserAction(array_unique($users), 'addToGroups', array('addDefaultGroups' => false, 'deleteOldGroups' => false, 'groups' => array($groupID))); $userAction->executeAction(); } }
/** * Disables users. */ public function disable() { if (empty($this->objects)) { $this->readObjects(); } $action = new UserAction($this->objects, 'update', array('data' => array('activationCode' => UserRegistrationUtil::getActivationCode()), 'removeGroups' => UserGroup::getGroupIDsByType(array(UserGroup::USERS)))); $action->executeAction(); $action = new UserAction($this->objects, 'addToGroups', array('groups' => UserGroup::getGroupIDsByType(array(UserGroup::GUESTS)), 'deleteOldGroups' => false, 'addDefaultGroups' => false)); $action->executeAction(); $this->unmarkItems(); }
public function switchContext() { $userAction = new UserAction(array(WCF::getUser()), 'update', array('options' => array(User::getUserOptionID('recentActivitiesFilterByFollowing') => WCF::getUser()->recentActivitiesFilterByFollowing ? 0 : 1))); $userAction->executeAction(); }
/** * forget_password this function should send the email password change to this user * * @return Array */ public function forgetPassword($oMbqEtUser) { $oUser = $oMbqEtUser->mbqBind['oUser']; // generate a new lost password key $lostPasswordKey = StringUtil::getRandomID(); // save key and request time in database $objectAction = new UserAction(array($oUser), 'update', array('data' => array_merge($this->additionalFields, array('lostPasswordKey' => $lostPasswordKey, 'lastLostPasswordRequestTime' => TIME_NOW)))); $objectAction->executeAction(); // send mail $mail = new Mail(array($oUser->username => $oUser->email), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail', array('username' => $oUser->username, 'userID' => $oUser->userID, 'key' => $lostPasswordKey))); $mail->send(); return true; }
/** * @see \wcf\form\IForm::save() */ public function save() { parent::save(); // build conditions $this->conditions = new PreparedStatementConditionBuilder(); // deny self delete if ($this->action == 'delete') { $this->conditions->add("user_table.userID <> ?", array(WCF::getUser()->userID)); } // static fields if (!empty($this->username)) { $this->conditions->add("user_table.username LIKE ?", array('%' . addcslashes($this->username, '_%') . '%')); } if (!empty($this->email)) { $this->conditions->add("user_table.email LIKE ?", array('%' . addcslashes($this->email, '_%') . '%')); } if (!empty($this->groupIDs)) { $this->conditions->add("user_table.userID " . ($this->invertGroupIDs == 1 ? 'NOT ' : '') . "IN (SELECT userID FROM wcf" . WCF_N . "_user_to_group WHERE groupID IN (?))", array($this->groupIDs)); } if (!empty($this->languageIDs)) { $this->conditions->add("user_table.languageID IN (?)", array($this->languageIDs)); } // registration date if ($startDate = @strtotime($this->registrationDateStart)) { $this->conditions->add('user_table.registrationDate >= ?', array($startDate)); } if ($endDate = @strtotime($this->registrationDateEnd)) { $this->conditions->add('user_table.registrationDate <= ?', array($endDate)); } if ($this->banned) { $this->conditions->add('user_table.banned = ?', array(1)); } if ($this->notBanned) { $this->conditions->add('user_table.banned = ?', array(0)); } // last activity time if ($startDate = @strtotime($this->lastActivityTimeStart)) { $this->conditions->add('user_table.lastActivityTime >= ?', array($startDate)); } if ($endDate = @strtotime($this->lastActivityTimeEnd)) { $this->conditions->add('user_table.lastActivityTime <= ?', array($endDate)); } if ($this->enabled) { $this->conditions->add('user_table.activationCode = ?', array(0)); } if ($this->disabled) { $this->conditions->add('user_table.activationCode <> ?', array(0)); } // dynamic fields foreach ($this->activeOptions as $name => $option) { $value = isset($this->values[$option['optionName']]) ? $this->values[$option['optionName']] : null; $this->getTypeObject($option['optionType'])->getCondition($this->conditions, $option, $value); } // call buildConditions event EventHandler::getInstance()->fireAction($this, 'buildConditions'); // execute action switch ($this->action) { case 'sendMail': WCF::getSession()->checkPermissions(array('admin.user.canMailUser')); // get user ids $userIDs = array(); $sql = "SELECT\t\tuser_table.userID\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user user_table\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_option_value option_value\n\t\t\t\t\tON\t\t(option_value.userID = user_table.userID)" . $this->conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($this->conditions->getParameters()); while ($row = $statement->fetchArray()) { $userIDs[] = $row['userID']; $this->affectedUsers++; } if (!empty($userIDs)) { // save config in session $userMailData = WCF::getSession()->getVar('userMailData'); if ($userMailData === null) { $userMailData = array(); } $mailID = count($userMailData); $userMailData[$mailID] = array('action' => '', 'userIDs' => $userIDs, 'groupIDs' => '', 'subject' => $this->subject, 'text' => $this->text, 'from' => $this->from, 'enableHTML' => $this->enableHTML); WCF::getSession()->register('userMailData', $userMailData); WCF::getTPL()->assign('mailID', $mailID); } break; case 'exportMailAddress': WCF::getSession()->checkPermissions(array('admin.user.canMailUser')); // send content type header('Content-Type: text/' . $this->fileType . '; charset=UTF-8'); header('Content-Disposition: attachment; filename="export.' . $this->fileType . '"'); if ($this->fileType == 'xml') { echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<addresses>\n"; } // count users $sql = "SELECT\t\tCOUNT(*) AS count\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user user_table\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_option_value option_value\n\t\t\t\t\tON\t\t(option_value.userID = user_table.userID)\n\t\t\t\t\t" . $this->conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($this->conditions->getParameters()); $count = $statement->fetchArray(); // get users $sql = "SELECT\t\tuser_table.email\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user user_table\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_option_value option_value\n\t\t\t\t\tON\t\t(option_value.userID = user_table.userID)\n\t\t\t\t\t" . $this->conditions . "\n\t\t\t\t\tORDER BY\tuser_table.email"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($this->conditions->getParameters()); $i = 0; while ($row = $statement->fetchArray()) { if ($this->fileType == 'xml') { echo "<address><![CDATA[" . StringUtil::escapeCDATA($row['email']) . "]]></address>\n"; } else { echo $this->textSeparator . $row['email'] . $this->textSeparator . ($i < $count['count'] ? $this->separator : ''); } $i++; $this->affectedUsers++; } if ($this->fileType == 'xml') { echo "</addresses>"; } $this->saved(); exit; break; case 'assignToGroup': WCF::getSession()->checkPermissions(array('admin.user.canEditUser')); $_this = $this; $userIDs = $this->fetchUsers(function ($userID, array $userData) use($_this) { $user = new UserEditor(new User(null, $userData)); $user->addToGroups($_this->assignToGroupIDs, false, false); }); if (!empty($userIDs)) { UserStorageHandler::getInstance()->reset($userIDs, 'groupIDs', 1); } break; case 'delete': WCF::getSession()->checkPermissions(array('admin.user.canDeleteUser')); $userIDs = $this->fetchUsers(); if (!empty($userIDs)) { $userAction = new UserAction($userIDs, 'delete'); $userAction->executeAction(); } break; } $this->saved(); WCF::getTPL()->assign('affectedUsers', $this->affectedUsers); }
/** * Saves changes to user profile. * * @return array */ public function save() { $userTitle = null; if (isset($this->parameters['values']['__userTitle'])) { $userTitle = StringUtil::trim(MessageUtil::stripCrap($this->parameters['values']['__userTitle'])); unset($this->parameters['values']['__userTitle']); } $optionHandler = $this->getOptionHandler($this->userProfile->getDecoratedObject()); $optionHandler->readUserInput($this->parameters); $errors = $optionHandler->validate(); // validate user title if ($userTitle !== null) { try { if (mb_strlen($userTitle) > USER_TITLE_MAX_LENGTH) { throw new UserInputException('__userTitle', 'tooLong'); } if (!StringUtil::executeWordFilter($userTitle, USER_FORBIDDEN_TITLES)) { throw new UserInputException('__userTitle', 'forbidden'); } } catch (UserInputException $e) { $errors[$e->getField()] = $e->getType(); } } // validation was successful if (empty($errors)) { $saveOptions = $optionHandler->save(); $data = array('options' => $saveOptions); // save user title if ($userTitle !== null) { $data['data'] = array('userTitle' => $userTitle); } $userAction = new UserAction(array($this->userProfile->userID), 'update', $data); $userAction->executeAction(); // check if the user will be automatically added to new // user groups because of the changed user options UserGroupAssignmentHandler::getInstance()->checkUsers(array($this->userProfile->userID)); // return parsed template $user = new User($this->userProfile->userID); // reload option handler $optionHandler = $this->getOptionHandler($user, false); $options = $optionHandler->getOptionTree(); WCF::getTPL()->assign(array('options' => $options, 'userID' => $this->userProfile->userID)); return array('success' => true, 'template' => WCF::getTPL()->fetch('userProfileAbout')); } else { // validation failed WCF::getTPL()->assign(array('errorType' => $errors, 'optionTree' => $optionHandler->getOptionTree(), '__userTitle' => $userTitle !== null ? $userTitle : $this->userProfile->userTitle)); return array('success' => false, 'template' => WCF::getTPL()->fetch('userProfileAboutEditable')); } }
/** * Shows the page for creating the admin account. */ protected function createUser() { $errorType = $errorField = $username = $email = $confirmEmail = $password = $confirmPassword = ''; $username = ''; $email = $confirmEmail = ''; $password = $confirmPassword = ''; if (isset($_POST['send']) || self::$developerMode) { if (isset($_POST['send'])) { if (isset($_POST['username'])) { $username = StringUtil::trim($_POST['username']); } if (isset($_POST['email'])) { $email = StringUtil::trim($_POST['email']); } if (isset($_POST['confirmEmail'])) { $confirmEmail = StringUtil::trim($_POST['confirmEmail']); } if (isset($_POST['password'])) { $password = $_POST['password']; } if (isset($_POST['confirmPassword'])) { $confirmPassword = $_POST['confirmPassword']; } } else { $username = $password = $confirmPassword = '******'; $email = $confirmEmail = '*****@*****.**'; } // error handling try { // username if (empty($username)) { throw new UserInputException('username'); } if (!UserUtil::isValidUsername($username)) { throw new UserInputException('username', 'notValid'); } // e-mail address if (empty($email)) { throw new UserInputException('email'); } if (!UserUtil::isValidEmail($email)) { throw new UserInputException('email', 'notValid'); } // confirm e-mail address if ($email != $confirmEmail) { throw new UserInputException('confirmEmail', 'notEqual'); } // password if (empty($password)) { throw new UserInputException('password'); } // confirm e-mail address if ($password != $confirmPassword) { throw new UserInputException('confirmPassword', 'notEqual'); } // no errors // init database connection $this->initDB(); // get language id $languageID = 0; $sql = "SELECT\tlanguageID\n\t\t\t\t\tFROM\twcf" . WCF_N . "_language\n\t\t\t\t\tWHERE\tlanguageCode = ?"; $statement = self::getDB()->prepareStatement($sql); $statement->execute(array(self::$selectedLanguageCode)); $row = $statement->fetchArray(); if (isset($row['languageID'])) { $languageID = $row['languageID']; } if (!$languageID) { $languageID = LanguageFactory::getInstance()->getDefaultLanguageID(); } // create user $data = array('data' => array('email' => $email, 'languageID' => $languageID, 'password' => $password, 'username' => $username), 'groups' => array(1, 3, 4), 'languages' => array($languageID)); $userAction = new UserAction(array(), 'create', $data); $userAction->executeAction(); // go to next step $this->gotoNextStep('installPackages'); exit; } catch (UserInputException $e) { $errorField = $e->getField(); $errorType = $e->getType(); } } WCF::getTPL()->assign(array('errorField' => $errorField, 'errorType' => $errorType, 'username' => $username, 'email' => $email, 'confirmEmail' => $confirmEmail, 'password' => $password, 'confirmPassword' => $confirmPassword, 'nextStep' => 'createUser')); WCF::getTPL()->display('stepCreateUser'); }
/** * @see \wcf\form\IForm::save() */ public function save() { parent::save(); $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->userIDs)); $sql = "SELECT\tuserID, groupID\n\t\t\tFROM\twcf" . WCF_N . "_user_to_group\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); $groups = array(); while ($row = $statement->fetchArray()) { $groups[$row['userID']][] = $row['groupID']; } foreach ($this->users as $user) { if (!UserGroup::isAccessibleGroup($groups[$user->userID])) { throw new PermissionDeniedException(); } $groupsIDs = array_merge($groups[$user->userID], $this->groupIDs); $groupsIDs = array_unique($groupsIDs); $action = new UserAction(array(new UserEditor($user)), 'addToGroups', array('groups' => $groupsIDs, 'addDefaultGroups' => false)); $action->executeAction(); } ClipboardHandler::getInstance()->removeItems($this->objectTypeID); SessionHandler::resetSessions($this->userIDs); $this->saved(); WCF::getTPL()->assign(array('groupIDs' => $this->groupIDs, 'message' => 'wcf.acp.user.assignToGroup.success', 'users' => $this->users)); WCF::getTPL()->display('success'); exit; }
/** * @see \wcf\form\IForm::save() */ public function save() { foreach ($this->userIDs as $userID) { if ($userID != $this->destinationUserID) { $this->mergedUserIDs[] = $userID; } } parent::save(); // poll_option_vote $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE IGNORE\twcf" . WCF_N . "_poll_option_vote\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // comment $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_comment\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // comment_response $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_comment_response\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // profile comments $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.user.profileComment'); $conditions = new PreparedStatementConditionBuilder(); $conditions->add("objectTypeID = ?", array($objectType->objectTypeID)); $conditions->add("objectID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_comment\n\t\t\tSET\tobjectID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // like (userID) $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE IGNORE\twcf" . WCF_N . "_like\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // like (objectUserID) $conditions = new PreparedStatementConditionBuilder(); $conditions->add("objectUserID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_like\n\t\t\tSET\tobjectUserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // like_object $conditions = new PreparedStatementConditionBuilder(); $conditions->add("objectUserID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_like_object\n\t\t\tSET\tobjectUserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // user_follow (userID) $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $conditions->add("followUserID <> ?", array($this->destinationUserID)); $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_follow\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // user_follow (followUserID) $conditions = new PreparedStatementConditionBuilder(); $conditions->add("followUserID IN (?)", array($this->mergedUserIDs)); $conditions->add("userID <> ?", array($this->destinationUserID)); $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_follow\n\t\t\tSET\t\tfollowUserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // user_ignore (userID) $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $conditions->add("ignoreUserID <> ?", array($this->destinationUserID)); $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_ignore\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // user_ignore (ignoreUserID) $conditions = new PreparedStatementConditionBuilder(); $conditions->add("ignoreUserID IN (?)", array($this->mergedUserIDs)); $conditions->add("userID <> ?", array($this->destinationUserID)); $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_ignore\n\t\t\tSET\t\tignoreUserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // user_object_watch $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_object_watch\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // user_activity_event $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_user_activity_event\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // attachments $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_attachment\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // modification_log $conditions = new PreparedStatementConditionBuilder(); $conditions->add("userID IN (?)", array($this->mergedUserIDs)); $sql = "UPDATE\twcf" . WCF_N . "_modification_log\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); // delete merged users $action = new UserAction($this->mergedUserIDs, 'delete'); $action->executeAction(); // reset clipboard ClipboardHandler::getInstance()->removeItems($this->objectTypeID); SessionHandler::resetSessions($this->userIDs); $this->saved(); // show success message WCF::getTPL()->assign('message', 'wcf.global.success'); WCF::getTPL()->display('success'); exit; }
/** * Removes group memberships. */ public function removeGroupMemberships() { if (empty($this->objects)) { $this->readObjects(); } foreach ($this->objects as $subscriptionUser) { $groupIDs = array(); foreach (explode(',', $subscriptionUser->getSubscription()->groupIDs) as $groupID) { if (UserGroup::getGroupByID($groupID) !== null) { $groupIDs[] = $groupID; } } if (!empty($groupIDs)) { $action = new UserAction(array($subscriptionUser->userID), 'removeFromGroups', array('groups' => $groupIDs)); $action->executeAction(); } } }