I am trying to design a custom user registration form theme in a subtheme of drupal.
The name of the subtheme is unchanged.

In order to use my custom design, I updated the template.php file in "/sites/all/themes/adaptivetheme/adaptivetheme_subtheme". I added the following php snippet:

function adaptivetheme_subtheme_theme() {
  return array( 
    'user_register' => array(
      'arguments' => array('form' => NULL),
      'template' => 'user-register',
    ),
  );
}

Usually in other themes its working fine and I'm getting an error messages telling that the "user-register.tpl.php" file is missing.........but in adaptive theme, just after updating, the website is turning completely blank.
Then I created a user-register.tpl.php file and uploaded it in the same directory. I used the following code in the file:

drupal_set_title('Sign Up');
echo drupal_render($form);

It was supposed to show the default registration page with the heading "Sign Up".....But no result....still the same blank website.....

Please help.

Comments

Jeff Burnz’s picture

You are missing one crucial step - adding the preprocess function to render variables for the template:

Use the following code:

In template.php add this...

function adaptivetheme_subtheme_theme() {
  return array(
    'user_register' => array(
      'template' => 'user-register',
      'arguments' => array('form' => NULL),
    ),
  );
}
function adaptivetheme_subtheme_preprocess_user_register(&$vars) {
  $vars['myform'] = drupal_render($vars['form']);
  drupal_set_title('Signup');
}

Then add the template, this must be in the same directory as the template.php file, else you can add "path" to the theme() array (see the docs).

Here's the template code (user-register.tpl.php), to match the variables we set in the preprocess function:

<div class="my-awesome-form">
  <?php print $myform; ?>
</div>

Remember to clear the theme registry!

Aritra’s picture

Tried hard......failed miserably. Somehow I cant manage to do it in adaptive theme. Results are same as before.
Is there any more solution?

Jeff Burnz’s picture

Priority: Critical » Normal

Sorry but that is how its done. I can only think that you are either making a typo or not clearing the theme registry, or making some mistake that is small but crucial to making it work.

Jeff Burnz’s picture

Component: Subtheme » CSS/HTML
Status: Active » Closed (fixed)