I have a front end user registration form, and I want users to receive a set password email after they've been activated manually in the back end by an admin. When they submit the user registration form, their account shouldn't be automatically activated, so I've checked the "verify email addresses" option in the user settings. However, with this setting enabled, a new user automatically receives an email to activate their account. Is there a way to prevent this account activation email from being sent when the user is first created in the system?
If I can prevent the initial account activation email from being sent, I can add a trigger to a custom module that sends the set password email after the user is activated by an admin, like so:
Event::on(
Users::class,
Users::EVENT_AFTER_ACTIVATE_USER,
function (Event $event) {
$users = Craft::$app->getUsers();
$users->sendActivationEmail($event->user);
}
);
This would allow me to have the set password email sent at the appropriate time.
In short, how can I have a front end registered user receive a set password email only after their account has been activated manually by an admin?