I need to change layout of a profile depending on user's field. So, I need to either include regions in user-profile.tpl.php
or access $user_profile
to test that field in page.tpl.php
.
I've seen this done, but can't find it now.
As for including regions in user-profile.tpl.php
here how you do it.
In your custom theme add the following code to template.php file
function mytheme_preprocess_user_profile(&$variables) {
// List of all regions for the current theme
foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
// Add content to $region variable
if ($blocks = block_get_blocks_by_region($region_key)) {
$variables['region'][$region_key] = $blocks;
}
else {
$variables['region'][$region_key] = array();
}
}
}
Then copy user-profile.tpl.php
to your custom theme and then place the following code between any HTML tag.
print render($region['region_name']);