Search code examples
prestashopprestashop-1.6

Prestashop how to know when a new user makes register in the store


I am using prestashop 1.6. I wanted to know how can I get to know when some user makes register in the store? Is there any kind of hook or something like that? Any help and suggestions will be really appreciable. Thanks


Solution

  • there's an hook and it's called right after a customer has been succesfully registered to the website. The hook name is actionCustomerAccountAdd, that you can call in your custom module by the function hookActionCustomerAccountAdd($params){ ... }, and registering it by $this->registerHook('actionCustomerAccountAdd')

    the code of the hook is found inside the AuthController :

        Hook::exec('actionCustomerAccountAdd', array(
                            '_POST' => $_POST,
                            'newCustomer' => $customer
                        ));
    

    as you can see you have access to the full $_POST of the registration form + the new customer object created with it. If you need an example on how to use the hook you can see the code of the blocknewsletter module, it uses an actionCustomerAccountAdd hook, right as you need it.