According to Drupal official website http://drupal.org/node/350634 article.
The custom user login, registration and password reset pages are simple, with the following steps:
Step one: In the folder where the theme is located, edit the template.php file, look for a function named Yourtheme_theme (Yourtheme refers to the name of the theme you use), and make the following modifications:
?
1 2 3 4 5 6 7 8 9 Ten each of the above |
/** * Registers overrides for VA rious functions. * * In this case, overrides three user functions */function Yourtheme_theme () { return array ( & nbsp; ' user_login ' = = Array ( ' template ' = ' user-login ', ' arguments ' = = Array (' form ' = NULL), ), & nbsp ' User_register ' = = Array ( ' template ' = ' user-register ', ' arguments ' = = Array (' form ' = NULL), ), & nbsp ' User_pass ' = Array ( ' template ' = ' user-pass ', & nbsp; ' arguments ' = = Array (' form ' = NULL), ), ); } |
Attention:
Replace ' Yourtheme ' with your theme name
Three pages can use the same template, three templates are used in this column (User-login, User-register, and User-pass)
The name of the template uses dashes, not underscores
Attention is user-pass, not user-password.
Step Two:
Next, write three preprocessing functions, as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Function Yourtheme_preprocess_user_login (& $variables) {$variables [' intro_text '] = t (' This is my awesome Logi n Form '); $variables [' rendered '] = Drupal_render ($variables [' form ']); } function Yourtheme_preprocess_user_register (& $variables) {$variables [' intro_text '] = t (' This is my sup Er awesome reg form '); $variables [' rendered '] = Drupal_render ($variables [' form ']); } function Yourtheme_preprocess_user_pass (& $variables) {$variables [' intro_text '] = t (' This is my super A Wesome insane Password form '); $variables [' rendered '] = Drupal_render ($variables [' form ']); } |
Attention:
Replace ' Yourtheme ' with your theme name
The text content of the variable $variables[' Intro_text ' in the array $variables is passed through $intro_text to the page
Step three: Create template files user-login.tpl.php and user-register.tpl.php to correspond to the ' template ' defined above and add code to this file:
?
1 2 3) 4 5 |
<p><?php print $intro _text,?></p> <div class = "My-form-wrapper" > <?php print $render Ed;?> </div> |
Step four: Save the file and empty the cache