Drupal login error message display on page by make new module I created the module and added the field in the user login block form for displaying error. I want to display the error in warning field instead of using form_set_error(). I am able to see the warning field in the login block. When I submit with error it did not display the error. Code is as under. I am missing how to refresh the value of form once it gets error.

function usermoved_form_user_login_block_alter(&amp;$form, &amp;$form_state) {
$form['warning'] = array(
'#value' =&gt; t('oops'),
'#weight' =&gt; 11
);
$form['#submit'][] = 'usermoved_form_submit_code';
}


function usermoved_form_submit_code($form, &amp;$form_state)
{
  global $user;
 if (!$user-&gt;uid) {
  $form['warning']['value']= "changed to something";

}

}


I have disabled the error in user.module as follows.

function user_login_final_validate($form, &amp;$form_state) {
  global $user;
   if (!$user-&gt;uid) {
//form_set_error('name', t('Sorry, unrecognized username or password. &lt;a  
    //href="@password"&gt;Have you forgotten your password?&lt;/a&gt;', array('@password' =&gt; 
    //url('user/password'))));
}
}
I suggest you DO NOT CHANGE DRUPAL CORE , if you want your custom validation use something like this

function usermoved_form_user_login_block_alter(&amp;$form, &amp;$form_state) {
   $form['warning'] = array(
   '#value' =&gt; t('oops'),
   '#weight' =&gt; 11
   );
  $form['#submit'][] = 'usermoved_form_submit_code';
  $form['#validate'][] = 'yourcustomvalidationfunction';
     }


and in your custom validate fuction  put your error in warning field   

 function   yourcustomvalidationfunction(&amp;$form,&amp;$form_state){
    if (your validation accure error) {
        $form['warning']['#value']= t('my error message that come in warning field') ;
       }
    }


or you can  create and initial warning  directly in validation function and not require create warning field in alter