0

(Using Adaptive Theme) I want a new and custom user login page. So, put this code in my template.php:

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

Changed mythemename to my custom theme name. And created user-login.tpl.php files and put this code:

<?php 
  print drupal_render($form['name']);
  print drupal_render($form['pass']);
  print drupal_render($form['form_build_id']);
  print drupal_render($form['form_id']);
  print drupal_render($form['actions']);
?>

Lastly, cleared my site cache. But when i click mysite.com/user login page not changed.

Where the error am I doing? How can I solve this problem?

Karmacoma
  • 658
  • 1
  • 13
  • 37
  • use name user--login.tpl.php instead of user-login.tpl.php bcoz in drupal 7 use double -- instead of 1 – mahipal purohit Mar 19 '13 at 05:47
  • Please do not cross-post questions. Pick one site that is best matched. http://drupal.stackexchange.com/questions/65475/error-when-creating-a-custom-page-in-d7 – Andrew Barber Apr 23 '13 at 18:45

1 Answers1

1

Try putting this in template.php, change mythemename to theme name, and flush the cache.

function mythemename_theme($existing, $type, $theme, $path){
    $hooks['user_login']=array(
    'render element'=>'form',
    'template'=>'templates/user-login',
    );
    return $hooks;
}

Then in templates/user-login.tpl.php insert:

<?php
print render($form['name']);
print render($form['pass']);
print render($form['form_build_id']);
print render($form['form_id']);
print render($form['actions']);
?>

or

<?php print drupal_render_children($form) ?>
firewaller
  • 426
  • 2
  • 8