Custom user_register_form for Auto Assign Role registration pages I'm using a function[a] to get custom templates to work for all pages, including role registration pages set by Auto Assign Role. By setting the role registration path to user/register/&lt;rolename&gt; I'm able to use page--user--register--rolename.tpl.php to make custom pages.



What I'm trying to do now is use a custom user_register_form for each role registration page. Using this function[b] I'm able to use user-register-form.tpl.php to customize the registration form. This affects the form for both role pages though. I tried using the Field Permissions module, but because an anonymous user will be using both forms it's of no use here. 

I'm thinking I need to change what user-register-form template the page itself is looking for, but I can't figure out how to do that.

a.

function THEMENAME_preprocess_page(&amp;$vars) {

  if (isset($vars['node'])) {

    $suggests = &amp;$vars['theme_hook_suggestions'];

    $args = arg();
    // Remove first argument of "node".
    unset($args[0]);

    $type = "page__type_{$vars['node']-&gt;type}";

    $suggests = array_merge(
      $suggests,
      array($type),
      theme_get_suggestions($args, $type)
    );
  }
}


b.

 function THEMENAME_theme() {
  $items = array();

  $items['user_login'] = array(
    'render element' =&gt; 'form',
    'path' =&gt; drupal_get_path('theme', 'THEMENAME') . '/templates',
    'template' =&gt; 'user-login',
    'preprocess functions' =&gt; array(
       'THEMENAME_preprocess_user_login'
    ),
  );
  $items['user_register_form'] = array(
    'render element' =&gt; 'form',
    'path' =&gt; drupal_get_path('theme', 'THEMENAME') . '/templates',
    'template' =&gt; 'user-register-form',
    'preprocess functions' =&gt; array(
      'THEMENAME_preprocess_user_register_form'
    ),
  );
  $items['user_pass'] = array(
    'render element' =&gt; 'form',
    'path' =&gt; drupal_get_path('theme', 'THEMENAME') . '/templates',
    'template' =&gt; 'user-pass',
    'preprocess functions' =&gt; array(
      'THEMENAME_preprocess_user_pass'
    ),
  );
  return $items;
}
I think if you already have a template file for the form user-register-form.tpl.php, you should be able to use a preprocess like this:

function MYTHEME_preprocess_user_register_form($vars) {
  // if role2
  // use other theme
}


There should be no need to define your own themes with hook_theme