0

I have created an installation profile. On one page i have added block using user_login_block form.

Now on the page there are other blocks also present.

Now when i submit the form without username and password, it should show me the form error, but it shows this message on next page reload.

I have checked $message variable is printed on the page also.

When i write any wrong password and try to login it will not show wrong username password message at that time, but when i reload the page second time at that time message will appear.

Has anyone faced such kind of situation. ?

Thanks in advance..

1 Answer 1

1

I successfully managed and fix it. The code i was using to display the login block was as below

print drupal_render(drupal_get_form('user_login_block'));

This block used to generate the login block for the login functionality.

Now i tried to render the messages using theme_status_messages() function.

To fix the issue i created a function in my template.php file named THEMENAME_get_login_block().

In this function i added the theme_status_messages() function for the displaying the messages. So my function looked like given below.

function THEMENAME_get_login_block() {
    $form = drupal_render(drupal_get_form('user_login_block'));
    $messages = theme_status_messages();
    return $form.$messages;
}

And to render the block i used print THEMENAME_get_login_block();

This solved my problem. But still i am curious to know the root cause of such kind of events. Any suggestions are welcomed....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.