I want to alter the User login form of drupal 7. I want only two fields Email ID and password. I don't want a username field. Please any one have idea to how to do these changes in User login form.


1 Answer 1


In order to delete the field in a form you have to print the form either using dpm($form) or print_r($form) and there you will get the field of username use that field to unset in form_alter .

function hook_form_alter(&$form, &$form_state, $form_id){

  if (form_id=="Your_form_id"){


  • 1
    If it's an answer to the question. Please add some description to it. Commented Dec 23, 2014 at 12:00
  • Thank you sir for your suggestion but I am new in drupal development. So plz tell me in which file i have to dump the variable $form. Commented Dec 25, 2014 at 7:53

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.