Form Set Error in custom module I am using Drupal7. I also use ife module.  I also wrote a custom module 

Here is my code 

function mymodule_validate($form, &amp;$form_state) {
    $name=$form_state['input']['name'];
    $pass=$form_state['input']['pass'];
    if(empty($pass) || $pass=='') {
           form_set_error('name', t('dummy message'));
        $errors=form_get_errors();
        print_r($errors);
        return $form;
    }


I also did some RND. when I check $form_state under complete form I got this array

 [complete form] =&gt; Array
        (
            [#action] =&gt; /logintest/node?destination=node
            [#id] =&gt; user-login-form
            [#validate] =&gt; Array
                (
                    [0] =&gt; user_login_name_validate
                    [1] =&gt; user_login_authenticate_validate
                    [2] =&gt; user_login_final_validate
                    [3] =&gt; mymodule_validate
                    [4] =&gt; ife_form_validator
                )


Here means the sequence of module working functions. 

Now  when I print $errors, 
it is showing 

Array
(
    [pass] =&gt; Password field is required.
    [name] =&gt; Sorry, unrecognized username or password. &lt;a href="/logintest/user/password"&gt;Have you forgotten your password?&lt;/a&gt;
)


But I am accepting 

Array
(
    [pass] =&gt; Password field is required.
    [name] =&gt; dummy message
)


But I don't know why it is not overwriting custom message..  Can anybody tell me how to resolve this issue. 

Thanks a lot.
You can try this  under your hook_validate

Here i added new function name mymodule_soft_block_validate

 function mymodule_validators() {
        return array('user_login_name_validate', 'user_login_authenticate_validate', 'mymodule_soft_block_validate','user_login_final_validate','mymodule_validate');
    }

function  mymodule_soft_block_validate($form, &amp;$form_state) {
        $pass=$form_state['values']['pass'];
        if(empty($pass) || $pass=='') {
            form_set_error('name', t('dummy message'));
            return $form;
        }           

}