Drupal - Hide or disable field after registration
If you want to do it in custom module
my_module_form_user_profile_form_alter(&$form, &$form_state) {
// Since it is on registration form, field might be reqruied.
$form['your_field']['#required'] = FALSE;
$form['your_field']['#access'] = FALSE;
}
You can try Field Permissions Module
Features
- Enable field permissions on any entity, not just nodes.
- Role-based field permissions allowing different viewing patterned based on what access the user has.
- Author-level permissions allow viewing and editing of fields based on who the entity owner is.
- Permissions for each field are not enabled by default. Instead, administrators can enable these permissions explicitly for the fields where this feature is needed.