this function caches the output, so it doesnt work if I want to change dynamically between two template files. For example user-profile.tpl.php and user-profile-project.tpl.php
Code:
function hook_theme_registry_alter(&$theme_registry) { $tmp1 = arg(0); $tmp2 = arg(1); $tmp3 = arg(2); if ($tmp1 == "user" && is_numeric($tmp2) && !$tmp3) { $user = user_load($tmp2); $roles = $user->roles; if (in_array('project', $roles)) { $theme_registry['user_profile']['template'] = 'user-profile-project'; } } } So how can I do this differently?