I just installed and configured the logintoboggan module; I created extra fields and they are displayed just fine. I can't remember how to disable the drupal default username field on the registration form.

Can anyone assist me?

1 Answer 1


To disable a field in a form you must use hook_form_alter() like

MYMODULE_form_alter($form, $form_state, $form_id) {
  if ($form_id == 'user_register_form' ) { // id of registration form
    $form['account']['name']['#access'] = FALSE;


Used by: All elements and forms

Description: Whether the element is accessible or not; when FALSE, the element is not rendered and the user submitted value is not taken into consideration.

I would also like to mention for other people reading this that this can also be accomplished with the email_registration module

  • can u please let me know how can remove or disable username from registration form using email_registration module.
    – user7048
    Commented Apr 10, 2013 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.