Answer the question
In order to leave comments, you need to log in
How to add a field to the registration form programmatically?
How to add a field to the registration form programmatically? Well and to keep this value?
I'm looking in the direction of hook_form_alter () but I don't understand how it works yet
Answer the question
In order to leave comments, you need to log in
function yourmodulename_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'user_register_form') {
$form['newfield'] = array(
'#type' => 'textfield',
'#title' => t('Sample field')
);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question