Jump to content

hooking registration


Recommended Posts

I'm trying to add some advanced validation fields in registration form, but apparently they are checked after the user has been entered to the database

Can anyone paste a snippet of hookCreateAccount that will return the errors and not add the user to the db?



Link to comment
Share on other sites



I do not think that there are people who will write all solution to you ;)


But you might try to use this kind of error handling:


$this->errors[] = Tools::displayError('Invalid e-mail address');


I am not sure if it works right especially with $this, but it's worth trying.


And the hook is executed in AuthController.php line 187.


EDIT: in addition, the values of form fields are checked before adding to the databse in createAccount hook, so there might be errors in your code.

Link to comment
Share on other sites

I tried. Apparently, according to nethercott, the hook is "Used to run code after a new customer account has been created."


I'll need to either:

- create another hook in the validation, prior to the 'createAccount' hook (which i don't think can be done from a module)

- add some fancy ajax to stop the form from being submitted, thus interfering with the look and feel of presta

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...