Reputation: 22497
In Drupal 7, is there a way to display a mandatory field at registration, and make it un-editable after the user has registered?
Thanks in advance!
Upvotes: 0
Views: 993
Reputation: 22592
From the Drupal backend:
From here you can add your new field (Be sure to check the box that asks if this field should be present on user registration form)
Then you'll want to use a hook to disable this field in the user_profile
form.\
Code: template.php
function THEME_form_alter(&$form, &$form_state, $form_id) {
switch($form_id) {
case 'user_profile_form':
$form['field_my_field']['#disabled'] = true;
break;
}
}
Upvotes: 3