I'm trying to create a pending user account when an event occurs
$newUser = new User([
'firstName' => $submission->firstName->getValue(),
'lastName' => $submission->lastName->getValue(),
'username' => $email,
'email' => $email,
'password' => Yii::$app->security->generatePasswordHash($submission->password->getValue()),
'isCandidate' => true,
]);
Craft::$app->getElements()->saveElement($newUser, false);
but that always creates an enabled user.
I know that I want to do Craft::$app->getUsers()->sendActivationEmail($newUser);
after the fact to send the activation email that works.