3

How would I make a template for the user registration page? I want to theme the entire page, not just the form. I've tried page--user-register.tpl.php but that does not work.

Dustin
  • 4,314
  • 12
  • 53
  • 91

5 Answers5

4

You want to use page--user--register.tpl.php instead of page--user-register.tpl.php.

page--user-register.tpl.php changes the template for the page user-register, while page--user--register.tpl.php changes the template for the page user/register.

Will
  • 334
  • 3
  • 9
3

I recommend using the theme developer module

It will show you all the template suggestions for any given page, and what to call them. Also make sure you are clearing your cache.

Also This is a great resource

jwilcox09
  • 721
  • 5
  • 18
3

Drupal out of the box does not provide any template suggestions for the registration form. You'd need to write a custom module to add it. You can do something like this:

/**
 * Implements hook_theme().
 */
function mymodule_theme() {
  $items = array(
    'user_register_form' => array(
      'render element' => 'form',
      'template' => 'templates/user-register-form',
    ),
  );
  return $items;
}

Then you'd have a template in mymodule/templates called user-register-form.tpl.php which you can customize or override in your theme.

Sean Robertson
  • 353
  • 1
  • 8
1

Drupal 7

Add this code to your template.php in your theme directory.

    function yourtheme_theme() {
      return array(
        'user_login' => array(
          'template' => 'user-login',
          'arguments' => array('form' => NULL),
        ),
      );
    }

    function yourtheme_theme() {
      $items = array();
      $items['user_login'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'yourtheme') . '/templates',
        'template' => 'user-login',
        'preprocess functions' => array(
           'yourtheme_preprocess_user_login'
        ),
      );
      return $items;
    }

    function yourtheme_preprocess_user_login(&$vars) {
      $vars['intro_text'] = t('This is my awesome login form');
    }

Create a file in your theme's "templates" folder called user-login.tpl.php.

Add this code and change "yourtheme" to your theme name.

 <?php print drupal_render_children($form) ?>

Clear you cache.

Source (Where you can find details on how to do this for user-register-form, user-password-form, and Drupal 6) https://drupal.org/node/350634

AdamG
  • 2,570
  • 3
  • 24
  • 35
0

Another way will be using "Panel" to create custon registration page :

  1. Install and enable Panel Module
  2. Create new page "registration page" and design the layout
  3. Add content to your regions. For your case, the "registration block" or "login block"
ProjectAO
  • 73
  • 1
  • 7