views:

238

answers:

6

I would like to be able to run some functionality with a module that I am building whenever a customer registers an account, but I can't seem to find any events that are fired upon a new customer registration. Does anybody know of an event that is dispatched for that?

+1  A: 

Whenever I'm looking for an event, I'll temporarily edit the Mage.php file to output all the events for a particular request.

File: app/Mage.php
public static function dispatchEvent($name, array $data = array())
{
    Mage::log('Event: ' . $name); //not using Mage::log, as 
    //file_put_contents('/tmp/test.log','Dispatching '. $name. "\n",FILE_APPEND); //poor man's log
    Varien_Profiler::start('DISPATCH EVENT:'.$name);
    $result = self::app()->dispatchEvent($name, $data);
    #$result = self::registry('events')->dispatch($name, $data);
    Varien_Profiler::stop('DISPATCH EVENT:'.$name);
    return $result;
}

and then perform whatever action it is I'm trying to hook into. Magento events are logically named, so scanning/sorting through the resulting logs usually reveals what I'm after.

Alan Storm
Definitely helpful, no doubt. However, I would still like an answer to my question, so I will not consider this an answer.
Prattski
You're welcome?
Alan Storm
Thanks Alan. I said it was helpful, but ultimately you didn't actually answer the question. It's you asking me what color of Green to use, and I tell you to use Sherman Williams glossy. It's helpful, but not an actual answer to the question.
Prattski
It is if you have the Sherman Williams glossy sitting right next to you
Alan Storm
And the band played "teach a man to fish..."
Jonathan Day
A: 

event name:customer_registration_is_allowed

I'm not sure if this is you want,you can write a observer to test

alex
A: 

The answer to this question is that there isn't an event for that.

Prattski
Turns out that you can hook into a specific event, see my new post for details.
Jonathan Day
+1  A: 

I've discovered that the customer_login and customer_session_init events are both thrown on account create. You could register a listener for either and then check to see the create date on the account?

Jonathan Day
A: 

You can try customer_save_after, the only thing that the registration sends this event twice

A: 

I'm sure this is way too late for your original need, but I'm pleased to report that I discovered how to achieve this today for another client request. It involves using one of the generic controller events. This node in the config.xml will hook into the right event:

<events>
 ....
  <controller_action_postdispatch_customer_account_createPost>
    <observers>
     <your_module_here>...etc

The controller_action_postdispatch_REQUESTPATH event is thrown for every controller that extends Mage_Core_Controller_Front_Action (which is basically all of them) which makes it very easy to target. Ditto for controller_action_predispatch_REQUESTPATH.

HTH, JD

Jonathan Day