Hi I'm trying to use a custom user-register-form.tpl based on the path made by this module.

I was able to get page--user--register--<user>.tpl to work by setting the path to /user/register/<user> in auto assign role pages. Using $page to render forms has given me some trouble, so I'm trying to just have each path use a different user-register-form.tpl.

This is the function I'm using to get user-register-form.tpl to work:

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

  $items['user_login'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
    'template' => 'user-login',
    'preprocess functions' => array(
       'MYTHEME_preprocess_user_login'
    ),
  );
  $items['user_register_form'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
    'template' => 'user-register-form',
    'preprocess functions' => array(
      'MYTHEME_preprocess_user_register_form'
    ),
  );
  $items['user_pass'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
    'template' => 'user-pass',
    'preprocess functions' => array(
      'MYTHEME_preprocess_user_pass'
    ),
  );
  return $items;
}

If using a different user-register-form.tpl isn't possible could I maybe hide fields in one path somehow?

In case it matters this is the function I'm using to get page--user--register--<user>.tpl to work:

function MYTHEME_preprocess_page(&$vars) {

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

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

    $args = arg();

    unset($args[0]);

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

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

I appreciate any help!

Comments

janebootydoe’s picture

Issue summary: View changes