Redirect users to different page after a login failure in d7 I want to redirect the users to different page if they enter the wrong login details, for that I am using following code but it is not working.

function bartik_form_alter(&amp;$form, &amp;$form_state, $form_id)
{
    if ($form_id == "user-login")
    {
        $form["#validate"][] = "bartik_validate_login";
    }
}

function bartik_validate_login($form, &amp;$form_state)
{
    // on successful login, the uid is set in form_state.
    if (empty($form_state["uid"]))
    {
        $_GET["destination"] = "some url goes here";
        drupal_goto("some url goes here"); 
    }
}
Please try with the correct form_id for user login.

i.e: if ($form_id == 'user_login') {

The form_id can be found in the HTML source hidden element

&lt;input type="hidden" name="form_id" id="edit-user-login" value="user_login"&gt;