Drupal7 modified user login no effect?

34 views Asked by At

I am new to Drupal. I am trying to create a modified login page.

I have modified the template.php of my theme with the name "cmse" in /sites/all/themes/cmse/

This is my template.php:

<?php
function cmse_preprocess_html(&$vars) {
  $vars['classes_array'][] = 'homepage';
  $vars['classes_array'][] = 'teaser';
}
function cmse_theme() {
  $items = array();
  // create custom user-login.tpl.php
  $items['user_login'] = array(
  'render element' => 'form',
  'path' => drupal_get_path('theme', 'cmse') . '/templates',
  'template' => 'user-login',
  'preprocess functions' => array(
  'cmse_preprocess_user_login'
  ),
 );
return $items;
}

This is the new file "user_login.tpl.php" in /sites/all/themes/cmse/templates

<?php
    // split the username and password so we can put the form links were we want (they are in the "user-login-links" div bellow)
    print drupal_render($form['name']);
    print drupal_render($form['pass']);
    ?>
    <div class="user-login-links">
    <span class="password-link"><a href="/user/password">Forget your password?</a></span> | <span class="register-link"><a href="/user/register">Create an account</a></span>
    </div>


    <?php
        // render login button
    print drupal_render($form['form_build_id']);
    print drupal_render($form['form_id']);
    print drupal_render($form['actions']);
    ?>

All changes doesn't have any effect to my login page. Any ideas what's wrong?

Thanks in advance

1

There are 1 answers

0
pal4life On BEST ANSWER

There could be a number of reasons.

Drupal cache is very notorious so ensure to clear cache. You can do that via instructions here

Clearing the cache The easiest way to clear the Drupal cache is to go to Administration > Configuration > Development > Performance (http://example.com/admin/config/development/performance) Click the button "Clear all caches"

Have you selected your new theme instead of existing one? Follow Instructions here on how to select a new theme.

Further just replacing values to the new theme name cmse may not work. The right way to do this would be to add a custom module and then call the .tpl.php file from there.