How can I modify the login form using hook_form_alter()? I'm trying to alter the login form with the following code: 

function git_form_alter(&amp;$form, $form_state, $form_id) {
  $forms = array(
    'user_login_block' =&gt; 'user-login-form',
    'user_login' =&gt; 'user-login'
  );
  if (array_key_exists($form_id, $forms)) {
       //my altering code
    }
}


I got this from the openidselector module that introduces some JavaScript widgets and more or less is what I'm trying to do.
When I go to mysite/user/login it doesn't call the block where I have to alter the form.
It simply doesn't call hook_form_alter(). 

A different thing is with the register form, or any other form, that are calling the hook.

Can anyone tell me what can I do? How is it possible that openidselector uses the same method, but in that module the code works, while it doesn't work in my code?
When I go to mysite/user/login it doesn't call the block where I have to alter the form. It simply doesn't call hook_form_alter().


example.com/user/login doesn't show the user login block; it shows the login form. Your code should work, even if I would rather make the code simpler (if you are not using "user-login-form" in any way).

function git_form_alter(&amp;$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
    // …
  }
}


As for the reason why the code doesn't work, I can think of the following reasons:


The hook name doesn't match the short name used for the module; for example, the short name of the module is "git_form" and you are using git_form_alter() for the implementation of hook_form_alter() when it should be git_form_form_alter().
You are editing a module that is enabled. In this case, when you add a new hook to the code, you also need to flush the cache used by Drupal as Drupal caches the list of hooks implemented by third-party modules.
The module is not enabled.