How to use hook alter form in module to register a user and also save some data in another table?

烈酒焚心 提交于 2020-01-06 01:57:07

问题


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).



来源:https://stackoverflow.com/questions/3014069/how-to-use-hook-alter-form-in-module-to-register-a-user-and-also-save-some-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!