1

drupal isn't recognising the page--user--login.tpl.php file. Tried clearing the cache. Still not working. I've never themed the user login page before. Any idea's?

I am running Drupal 7 and I want to theme the whole page. The other page template is being picked up. There isn't any other page--user--login.tpl.php in my theme directory

the page--user.tpl.php is being recognised but the page--user-login-tpl.php is not. bummer because i want the login page to be considerably different to the user page.

  • what version of drupal are you running? – Jimajamma Apr 29 '13 at 14:52
  • What do wou want to change? The whole page or only the form? – Rufein Apr 29 '13 at 14:53
  • I am running D7, and i want to theme the whole page. – Jeremy Apr 29 '13 at 14:57
  • it's the correct template name then, are other page templates in the same directory being picked up? if there is another page--user--login.tpl.php file elsewhere in your theme's directory structure, that one might be being picked up instead. – Jimajamma Apr 29 '13 at 15:00
5

This question is similar to https://stackoverflow.com/questions/8712061/style-drupal-7-log-in-page

It looks like you need to also have:

  • a page.tpl.php in your theme for page--anything-else.tpl.php to work
  • a page--user.tpl.php in your theme

You should also always clear the theme cache after adding/removing template files.

| improve this answer | |
  • 1
    looked promising! gave it a go. couldn't get it to work. – Jeremy Apr 29 '13 at 15:06
  • 2
    If it works the same way as node.tpl.php, you'll need page.tpl.php in your theme for page--anything-else.tpl.php to work (big if though, I haven't tried it) – Clive Apr 29 '13 at 15:15
  • what was the issue? – Jimajamma Apr 29 '13 at 15:31
  • ah ok. maybe i havent got it to work. the page--user.tpl.php file is being recognised however the page--user--login.tpl.php is still not being recognised. – Jeremy Apr 29 '13 at 15:35
  • More about having page--user.tpl.php requirement to alter page--user--login.tpl.php --- It's not the exact case. Say, if you want to have a custom comment.tpl.php variation (comment--blog.tpl.php), then you do need the base template in the theme's template folder to work (at least I had to). – AyeshK Apr 29 '13 at 16:21
1
 function themename_theme(&$existing, $type, $theme, $path) {
$hooks['user-login'] = array(
    'template' => 'templates/user-login',
    'render element' => 'form',
 );
  return $hooks;
}

Add this code to your template.php file. Then you can create user-login.tpl.php.

Note: Don't forget to clear the cache

| improve this answer | |

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.