2

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?

2

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

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

| improve this answer | |
  • Awesome, thanks for the tip. That worked perfectly. – Coppa Jun 24 '14 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.