<p>After a little more work, I came up with this approach that works-</p>

<p>First, I unchecked the verify email addresses option in the user settings.</p>

<p>Then, I added another trigger in my custom module- on before user save- that sets the new user's status to pending. The two triggers combined produce the functionality I'm looking for: </p>

<pre><code>    Event::on(
        User::class,
        User::EVENT_BEFORE_SAVE,
        function (Event $event) {
            if($event-&gt;isNew) {
                $event-&gt;sender-&gt;pending = true;
            }
        }
    );

    Event::on(
        Users::class,
        Users::EVENT_AFTER_ACTIVATE_USER,
        function (Event $event) {
            $users = Craft::$app-&gt;getUsers();
            $users-&gt;sendActivationEmail($event-&gt;user);
        }
    );
</code></pre>

CC BY-SA 4.0
2018-11-22T16:34:37.973Z
Re setting new user status to pending, the above may break in Craft 3.0.27+. See https://craftcms.stackexchange.com/questions/28216/how-can-i-set-new-user-accounts-to-pending-status-in-a-craft-3-module
Andrea DeMers
CC BY-SA 4.0
2018-06-18T21:20:26.080Z
2018-06-18T21:20:26.080Z
Dave F.
<p>This plugin does what you need i think (it did for me anyway  - so i could have manual user approval)  - <a href="https://concierge.olivierbon.com" rel="nofollow noreferrer">https://concierge.olivierbon.com</a></p>

CC BY-SA 4.0
2019-05-27T22:04:28.100Z
2019-05-27T22:04:28.100Z
Malcolm Maclean
<p>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?</p>

<p>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:</p>

<pre><code>    Event::on(
        Users::class,
        Users::EVENT_AFTER_ACTIVATE_USER,
        function (Event $event) {
            $users = Craft::$app-&gt;getUsers();
            $users-&gt;sendActivationEmail($event-&gt;user);
        }
    );
</code></pre>

<p>This would allow me to have the set password email sent at the appropriate time.</p>

<p>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?</p>

<craft3><users><emails><activation>
How can I prevent an account activation email from being sent to an unverified user who registered via a front end registration form?
# How can I prevent an account activation email from being sent to an unverified user who registered via a front end registration form?

(Asked by: username_0 on 2018-06-18)

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?

**Tags:** craft3, users, emails, activation


---

## 2 answers

### Answer by username_0 on 2018-06-18. Score: 1

After a little more work, I came up with this approach that works-
First, I unchecked the verify email addresses option in the user settings.
Then, I added another trigger in my custom module- on before user save- that sets the new user's status to pending. The two triggers combined produce the functionality I'm looking for: 
    Event::on(
        User::class,
        User::EVENT_BEFORE_SAVE,
        function (Event $event) {
            if($event->isNew) {
                $event->sender->pending = true;
            }
        }
    );

    Event::on(
        Users::class,
        Users::EVENT_AFTER_ACTIVATE_USER,
        function (Event $event) {
            $users = Craft::$app->getUsers();
            $users->sendActivationEmail($event->user);
        }
    );

> **Comments:**
> **username_1**: Re setting new user status to pending, the above may break in Craft 3.0.27+. See https://craftcms.stackexchange.com/questions/28216/how-can-i-set-new-user-accounts-to-pending-status-in-a-craft-3-module  

---

### Answer by username_2 on 2019-05-27. Score: 1

This plugin does what you need i think (it did for me anyway - so i could have manual user approval) - <https://concierge.olivierbon.com>


---

