I need to create advanced user profile page template.

I've copied user-profile.tpl.php from core to my template directory, file is used by backdrop, so far so good.

Now, here: https://api.backdropcms.org/api/backdrop/core!modules!user!templates!use... is mentioned: "Use render($user_profile) to print all profile items, or print a subset such as render($user_profile['user_picture'])". Which is fine and expected, but when I dpm all the variables I can see:

user_profile: (array, 8 elements) [... , ... , profile_uczestnik (array, 10 elements) [... , ... , ... , #markup(string)] , [...]]

So user_profile array, with profiles (I'm using profile module) but within each profile array there are no field objects, just flattened string. So I can do nothing in terms of template theming, because I have only render($user_profile) at my disposal.

I tried using hook_preprocess_user_profile, but there are no field objects either, just #markup.

How and where to get this variables one by one?


I've found missing variables.

By adding in line 443 of file /modules/profile/profile.module:

$account->content['profile_' . $type]['profile'] = array($profile);

I can get all profile variables in later stage, as late as template file. But it's an ugly hack, obviously. It looks like profile module was rewritten from scratch, and simplified...

drop's picture

Have you opened this issue in the Profile module queue? Looks like your fix might be a useful addition to the module (or perhaps there is a better way to achieve the same thing).