Drupal theme user login form

Posted under » Drupal on 21 July 2011

Add the following function in template.php file of the theme you are working on. This function is used to register theme implementation of user module. You can find more on this in this url http://api.drupal.org/api/function/hook_theme/6.

function garland_theme() {
  return array(
    'user_login' => array(
      'template' => 'user-login',
      'arguments' => array('form' => NULL),
Add the new look of the new form. Again, be sure to replace 'garland' with the actual name of your theme, or this will not work.
function garland_preprocess_user_login(&$variables) {
  $variables['form']['name']['#description'] = t('This is name text box.');
  $variables['form']['pass']['#description'] = t('This is password text box.');
  $variables['form']['name']['#title'] = t('My New Title.').
  $variables['rendered'] = drupal_render($variables['form']);
function drupal_render will render the $variable['form'] array.

Now in your create a file as user-login.tpl.php and put following code there. You can use your custom css stuff through this tpl file.

<div class="user-form-wrapper">
  <¿php print $rendered; ?>

After putting all the code, don't forget to clear your (theme) cache which is located under "performance".


web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data