How to add a Password reset link on user login block in Drupal

In Drupal 7, adding a link to allow users to reset their password (a “forgot my password” link) is quite easy through the hook_form_alter() hook.

 * implements hook_form_alter().
function mythemename_form_alter(&$form, &$form_state, $form_id)
    case 'user_login':
    case 'user_login_block':
      $form['links'] = array(
        array('#markup' => 'Forgot your password?'),
        '#weight' => 100,

Leave a Reply