use wcf\system\exception\UserInputException;
use wcf\system\language\LanguageFactory;
use wcf\system\request\RequestHandler;
+use wcf\system\user\group\assignment\UserGroupAssignmentHandler;
use wcf\system\WCF;
use wcf\util\UserRegistrationUtil;
if (isset($this->parameters['deleteOldGroups'])) $deleteOldGroups = $this->parameters['deleteOldGroups'];
if (isset($this->parameters['addDefaultGroups'])) $addDefaultGroups = $this->parameters['addDefaultGroups'];
+ $userIDs = [];
foreach ($this->getObjects() as $userEditor) {
+ $userIDs[] = $userEditor->userID;
$userEditor->addToGroups($groupIDs, $deleteOldGroups, $addDefaultGroups);
}
- //reread objects
+ if (empty($this->parameters['ignoreUserGroupAssignments'])) {
+ UserGroupAssignmentHandler::getInstance()->checkUsers($userIDs);
+ }
+
+ // reread objects
$this->objects = [];
UserEditor::resetCache();
$this->readObjects();
}
}
+ $userIDs = [];
+ foreach ($this->getObjects() as $user) {
+ $userIDs[] = $user->userID;
+ }
+ UserGroupAssignmentHandler::getInstance()->checkUsers($userIDs);
+
$this->unmarkItems();
}
use wcf\system\language\LanguageFactory;
use wcf\system\request\LinkHandler;
use wcf\system\user\authentication\UserAuthenticationFactory;
+use wcf\system\user\group\assignment\UserGroupAssignmentHandler;
use wcf\system\user\notification\object\UserRegistrationUserNotificationObject;
use wcf\system\user\notification\UserNotificationHandler;
use wcf\system\WCF;
];
$this->objectAction = new UserAction([], 'create', $data);
$result = $this->objectAction->executeAction();
+ /** @var User $user */
$user = $result['returnValues'];
$userEditor = new UserEditor($user);
// activation management
if (REGISTER_ACTIVATION_METHOD == 0) {
$this->message = 'wcf.user.register.success';
+
+ UserGroupAssignmentHandler::getInstance()->checkUsers([$user->userID]);
}
else if (REGISTER_ACTIVATION_METHOD == 1) {
// registering via 3rdParty leads to instant activation
$userAction = new UserAction(array_unique($users), 'addToGroups', [
'addDefaultGroups' => false,
'deleteOldGroups' => false,
- 'groups' => [$groupID]
+ 'groups' => [$groupID],
+ 'ignoreUserGroupAssignments' => true
]);
$userAction->executeAction();
}
$userAction = new UserAction([$user], 'addToGroups', [
'addDefaultGroups' => false,
'deleteOldGroups' => false,
- 'groups' => $newGroupIDs
+ 'groups' => $newGroupIDs,
+ 'ignoreUserGroupAssignments' => true
]);
$userAction->executeAction();
}