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.

5 Answers 5

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.

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

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.

0
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

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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.