Monday 22 March 2010

How to change Forgot Password html

first take view source of Request New Password page and find form_id which is user_pass.
write the following functions in your template.php file which you will find under your theme folder.
here I am using garland theme.

function garland_theme()
{
'user_pass' => array(
'template' => 'user-pass',
'arguments' => array('form' => NULL),
),

);
}

function garland_preprocess_user_pass(&$vars)
{
/*print '


';
   print_r($vars);
   print '
';*/

$tempVar = $vars['form'];
   
$tempVar['name']['#title'] = 'User Name or Email Address';
    $tempVar['submit']['#value'] = 'E-mail new password';
   
    $vars['username'] = drupal_render($tempVar['name']);       
    $vars['submit_button'] = drupal_render($tempVar['submit']);
   
    $vars['tempForm'] = drupal_render($tempVar);


}

Now create  user-pass.tpl.php and paste the below code into it and done.

<div id="registration_form">
  <div class="field">
    <?php
      print $username;
    ?>   
  </div>
  <div class="field">
    <?php
        echo $tempForm;       
        print $submit_button;
      ?>
    </div>
  </div>
</div>

Note: do not forget to clear cache of drupal from Administer -> Site Configuration -> Performance

1 comment: