<p>Use the <code>onSaveUser</code> event instead but check for the flag inside that event called <code>isNewUser</code></p>

<p><a href="http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser" rel="nofollow">http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser</a></p>

CC BY-SA 3.0
2014-06-24T20:49:20.183Z
Awesome, thanks for the tip. That worked perfectly.
Coppa
CC BY-SA 3.0
2014-06-24T00:45:58.010Z
2014-06-24T00:45:58.010Z
Luke Holder
<p>I'm trying to listen for an event when users create new accounts. I have the following code in my init() function in my main plugin class:</p>

<pre class="lang-php prettyprint-override"><code>craft()-&gt;on('users.activateUser', function(Event $event) {
    error_log("user activated");
});
</code></pre>

<p>This isn't firing when new users register on the site and I'm wondering if this has to do with the "Verify email addresses?" users setting. I'm not requiring users to verify their email addresses. Does that setting have to be checked in order to trigger that event? If so, is there a different event to listen for?</p>

<plugin-development><users>
Does "verify email addresses?" have to be enabled in order to fire the users.onActivateUser event?
# Does "verify email addresses?" have to be enabled in order to fire the users.onActivateUser event?

(Asked by: username_0 on 2014-06-23)

I'm trying to listen for an event when users create new accounts. I have the following code in my init() function in my main plugin class:
craft()->on('users.activateUser', function(Event $event) {
    error_log("user activated");
});

This isn't firing when new users register on the site and I'm wondering if this has to do with the "Verify email addresses?" users setting. I'm not requiring users to verify their email addresses. Does that setting have to be checked in order to trigger that event? If so, is there a different event to listen for?

**Tags:** plugin-development, users

---

## 1 answers

### Answer by username_1 on 2014-06-24. Score: 2 | Accepted answer

Use the `onSaveUser` event instead but check for the flag inside that event called `isNewUser`

<http://buildwithcraft.com/docs/plugins/events-reference#users-onSaveUser>

> **Comments:**
> **username_0**: Awesome, thanks for the tip. That worked perfectly.  

---

