How to use hook alter form in module to register a

2019-07-30 23:09发布

问题:

have a general idea on how to use hook alter to modify the feel of the registration form .

However the challenge I have is to not only have the user register, but to save some extra data into another table and then redirect user to a new page.

How would I get about doing that? Please help

回答1:

Again, it'd be easier to plan what you're trying to do and take advantage of common solutions. I suspect what you're after is the Content Profile module.



回答2:

add a custom function to your form, according to http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#submit-prop for more info

please notice the login page and the login block are different forms, with different form ids for your hook_form_alter.



回答3:

Just implement hook_user(); when the first parameter is 'register', the registration form is being presented to a user, and the module can change it by adding new form fields (the module needs to return them to Drupal).