I've created a website based on a Drupal 7 Zen subtheme and now I would like to create a login page for the administrator. When I navigate to http://mysite.com/?q=user, I return to the main page as specified in the page.tpl.php file. I would like to have a manual login page, so I tried following the following tutorial: https://drupal.org/node/350634. My template.php looks like this:

function camuse_theme() {
  $items = array();

  $items['user_login'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'camuse') . '/templates',
    'template' => 'user-login',
    'preprocess functions' => array(

  return $items;

function camuse_preprocess_user_login(&$vars) {
  $vars['intro_text'] = t('This is my awesome login form');

And my user-login.tpl.php file like this:

<p><?php print render($intro_text); ?></p>
<div class="camuse-user-login-form-wrapper">
<?php print drupal_render_children($form) ?>

However, when I navigate to http://mywebsite.com/?q=user, I still go to the home page. I don't know what I'm doing wrong here, I've checked the names and everything seems fine. Could anyone help me with this?


You have to change the name of your template file to user--login.tpl.php, place this file in the templates folder of camuse theme and clear all caches.

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.