user-profile.tpl.php Default theme implementation to present all user profile data.
This template is used when viewing a registered member's profile page, e.g., example.com/user/123. 123 being the users ID.
By default, all user profile data is printed out with the $user_profile variable. If there is a need to break it up you can use $profile instead. It is keyed to the name of each category or other data attached to the account. If it is a category it will contain all the profile items. By default $profile['summary'] is provided which contains data on the user's history. Other data can be included by modules. $profile['user_picture'] is available by default showing the account picture.
Also keep in mind that profile items and their categories can be defined by site administrators. They are also available within $profile. For example, if a site is configured with a category of "contact" with fields for of addresses, phone numbers and other related info, then doing a straight print of $profile['contact'] will output everything in the category. This is useful for altering source order and adding custom markup for the group.
To check for all available data within $profile, use the code below.
<?php
print '<pre>'. check_plain(print_r($profile, 1)) .'</pre>';
?>Available variables:
- $user_profile: All user profile data. Ready for print.
- $profile: Keyed array of profile categories and their items or other data provided by modules.
Where the html is handled for the group. Where the html is handled for each item in the group.
See also
template_preprocess_user_profile()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
Comments
You can also use $account
In addition to the
$user_profileand$profilevariables you can also use the variable$accountinuser-profile.tpl.phpto get raw user data without the markup.Bingo!!! You made my day. I
Bingo!!!
You made my day. I was looking for this.
Thanks
Even with D7?
I try with Drupal 7 and it doesn't seem to work.
I get Notice: Undefined variable: account in include()
Do you use D7?
thanks!
Solve the problem
I'e got it like that:
$profile_uid = $elements['#account']->uid;
yes!!!!
-
Thanks for the $elements tip, but this is a bit whacky, no way to access the normal $account fields like name or uid?