loginradiusloginradius Blog

Customize User Login, Register and Forgot Password Page in Drupal 7

Did you ever want to customize your registration or login page on Drupal 7, but did not know how? Customizing these pages by adding new text or changing theme…

Did you ever want to customize your registration or login page on Drupal 7, but did not know how? Customizing these pages by adding new text or changing theme is not a difficult task.

To help you out with that, I have compiled some simple steps to customize your registration or login page. All that you need to do is to add the following code :

Steps:

  1. In the first step of customization, you need to implement hook_theme in your module file.
 array(
      'template' => 'user_login',
      'render element' => 'form',
      'path' => drupal_get_path('module', 'yourmodule') . '/templates'
    ),
    'user_pass' => array(
      'template' => 'user_pass',
      'render element' => 'form',
      'path' => drupal_get_path('theme', 'yourmodule') . '/templates'
    ),
    'user_register' => array(
      'template' => 'user_register',
      'render element' => 'form',
      'path' => drupal_get_path('theme', 'yourmodule') . '/templates'
     ),
  );
  return $theme;
}-->

Now that you have implemented hook theme in module file, the next step is to implement three pre-process functions. These functions are used if module needs to override or you want to add something in theme pre-processing.

In the third step, you need to create following template files for login/register/forgot password.

  1. user_login.tpl.php
  2. user_register.tpl.php
  3. user_pass.tpl.php

Now paste the following code into user_login.tpl.php. Also, don’t forget to modify user_register.tpl.php and user_pass.tpl.php template files accordingly.

<!--

  
-->

Now your login page will contain new intro text This is my awesome login form. Customization of registration page in Drupal 7 is not difficult and if you follow above mentioned tips, you can design an amazing registration / login / forgot password page according to your audience.

Versha Gupta

Written by Versha Gupta

She is a software enthusiast, an avid contributor, and a regular blog writer. She usually works with React, UI/UX, Javascript, Node.js, and DevOps.

LoginRadius CIAM Platform

Our Product Experts will show you the power of the LoginRadius CIAM platform, discuss use-cases, and prove out ROI for your business.

Book A Demo Today