You could make use of the Profile module in the Core list of modules as well. It will solve this without any programming, fyi.
A:
Kevin
2010-06-14 01:31:50
yes the more I talk to people, the more they advise me to use that or the content module. Guess I jumped the gun by diving into code. Thanks for the tip though :)
2010-06-14 01:59:43
+2
A:
If you want to restrict your form alterations to a specific page, you can simply add a check for the page to your form id check, e.g.:
function special_registration_form_alter(&$form, $form_state, $form_id) {
// Alter the registration form, but only on 'user/register' pages
if ($form_id == 'user_register' && 'user' == arg(0) && 'register' == arg(1)) {
// snipped alteration code
}
}
Henrik Opel
2010-06-14 09:52:39
Ok, I didn't notice cam8001s similar answer in time - still leaving this version, as it combines the page and form id checks (no need to return FALSE, btw)
Henrik Opel
2010-06-14 10:03:10
cam8001
2010-06-14 16:02:59
A:
Implement hook_user()
; the function allow to alter the form presented to the users when they register on a site.
hook_user()
is used by user.module, and it is independent from the profile module.
Defining the hook as hook_user($op, &$edit, &$account, $category = NULL)
, the parameter $op
will contain the value 'register'
when the registration form is being presented to the user. In that case, the module returns the form fields it wants to add to the registration form.
kiamlaluno
2010-06-15 19:27:20