I'm trying to overwrite the FULL LOGIN PAGE, not only the login form!

I've tried this

function your_themename_theme() {
  $items = array();
  // create custom user-login.tpl.php
  $items['user_login'] = array(
  'render element' => 'form',
  'path' => drupal_get_path('theme', 'your_themename') . '/templates',
  'template' => 'user-login',
  'preprocess functions' => array(
return $items;

and this:

function YOURTHEME_theme() {
  return array(
    'user_login' => array(
      'template' => 'user-login',
      'variables' => array('form' => NULL), ## you may remove this line in this case
function YOURTHEME_preprocess_user_login(&$variables) {
    $variables['form'] = drupal_build_form('user_login', user_login(array(),$form_state)); ## I have to build the user login myself.

but that's only working for my login form. I have a website with all same layout pages but only the login is different. How can I disable regions and edit css from my login page?


Now I changed the name of the template to page--user--login.tpl and when I put <p>test</p> in my the template I see test in my browser. But when I type nothing I see the login form but also my sidebar/footer. How can I remove them?

1 Answer 1


The normal method for creating a custom page--user--login.tpl.php is not to create an empty file, but to copy the page.tpl.php supplied with the theme you're using into the templates/-directory of your sub-theme, rename it page--user--login.tpl.php, and edit the copy.

For instance, to remove the footer, just locate the markup in your copied page--user--login.tpl.php that is used to template the footer, and delete it!

<div id="footer-wrapper"><div class="section">

  <?php if ($page['footer_firstcolumn'] || $page['footer_secondcolumn'] || $page['footer_thirdcolumn'] || $page['footer_fourthcolumn']): ?>
    <div id="footer-columns" class="clearfix">
      <?php print render($page['footer_firstcolumn']); ?>
      <?php print render($page['footer_secondcolumn']); ?>
      <?php print render($page['footer_thirdcolumn']); ?>
      <?php print render($page['footer_fourthcolumn']); ?>
    </div> <!-- /#footer-columns -->
  <?php endif; ?>

  <?php if ($page['footer']): ?>
    <div id="footer" class="clearfix">
      <?php print render($page['footer']); ?>
    </div> <!-- /#footer -->
  <?php endif; ?>

</div></div> <!-- /.section, /#footer-wrapper -->

The block above is an example of how this may look like (this is from a copy of Bartik), if you copy it from another theme, it may look different.

But to get rid of it, you pull it into your favourite text editor and delete all of it.

  • but my page--user--login.tpl.php is empty
    – nielsv
    Apr 16, 2014 at 14:29
  • Ok, but how can I do this the right way?
    – nielsv
    Apr 16, 2014 at 14:36
  • Ok, thanks. So I just have to copy the page.tpl.php, rename to page--user--login.tpl.php and remove the parts I don't want, is this the right way?
    – nielsv
    Apr 16, 2014 at 14:41
  • Yup - that's it! Apr 16, 2014 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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