0
votes

I'm using garland's theme for my Drupal 6 administrator. I added a template called: page-user-login.tpl.php which I can access from mywebiste.com/user/login. Inside the template I simply added:

<html ...>
<head>
  <?php print $head ?>
  <?php print $styles ?>
</head>
<body>
  <?php
    print drupal_get_form('user_login_block');
    print $messages;
  ?>
</body>
</html>

The login form gets displayed and is working correctly for existing users.

However, if a user doesn't exists, no messages are displayed on the page. I tried using "theme_status_messages" and "drupal_get_messages" but they always are empty. What should I do in order to get the return error message?

PS: I'm creating a custom login page because it needs a complete different design than all the other pages.

2

2 Answers

2
votes

The user login form is already loaded up in the $content variable.

<?php print $content; // instead of print drupal_get_form(... ?>

I had a similar page override, so I just dropped in your method and confirmed errors do not display (user field does highlight red though). Errors do display when I print $content though.

My guess is it has to do with 2 of the same form being retrieved in the same page request.

1
votes

Page templates should have a preprocessed variable for messages:

<?php print $messages; ?>

(from here)

drupal_get_messages() is empty in the page template because it was already called on preprocess, to build the $messages variable. When that function is called the messages session variable is cleared.

Are you putting that into your page template anywhere?