Jump to content

hooking registration


oarecare
 Share

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?

 

TIA

Share this post


Link to post
Share on other sites

hi,

 

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

i concur that you will need to do some customization. you could override the controller and just add the new the new hook in the correct place.

 

Then create the module that does what you require when the hook is triggered.

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More