[development] aborting user registration and setting an error

Marc Poris marc at funnymonkey.com
Thu Jun 8 18:50:31 UTC 2006


Trevor,

Use 'validate' for $op and call form_set_error() to tell the 
registration process to fail.  See user_user() and _user_edit_validate() 
for an example.

- Marc



Trevor Mckeown wrote:

> Hi,
>
> I wrote a quick couple of lines of code that inserts a user into two
> other databases durning registration.  I accomplished this with
> hook_user under the $op value of "insert".
>
> I want to add a check with this module.  The check will search the
> other two databases for the email and username and make sure a dup is
> not about to be created.  If so I need the user to be redirected back
> to the register page and user registration aborted.
>
> The problem is, that I put such a check and redirect in in my
> hook_user function, but drupal is still creating the users in it's
> database and redirecting the registration page with the error.  I.E
> the registration process is not aborted.
>
> Maybe I need to use another $op value besides "insert"?  Maybe a
> different hook?  Maybe some function I am not aware of?
>
>
> Thanks
>
> --Trevor
>
>
>



More information about the development mailing list