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/<rolename>
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(&$vars) { if (isset($vars['node'])) { $suggests = &$vars['theme_hook_suggestions']; $args = arg(); // Remove first argument of "node". unset($args[0]); $type = "page__type_{$vars['node']->type}"; $suggests = array_merge( $suggests, array($type), theme_get_suggestions($args, $type) ); }}
b.
function THEMENAME_theme() { $items = array(); $items['user_login'] = array('render element' => 'form','path' => drupal_get_path('theme', 'THEMENAME') . '/templates','template' => 'user-login','preprocess functions' => array('THEMENAME_preprocess_user_login' ), ); $items['user_register_form'] = array('render element' => 'form','path' => drupal_get_path('theme', 'THEMENAME') . '/templates','template' => 'user-register-form','preprocess functions' => array('THEMENAME_preprocess_user_register_form' ), ); $items['user_pass'] = array('render element' => 'form','path' => drupal_get_path('theme', 'THEMENAME') . '/templates','template' => 'user-pass','preprocess functions' => array('THEMENAME_preprocess_user_pass' ), ); return $items;}