user-profile.tpl.php

You are here

  1. 7 modules/user/user-profile.tpl.php
  2. 6 modules/user/user-profile.tpl.php
  3. 8 core/modules/user/templates/user-profile.tpl.php

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.

  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

user-profile-category.tpl.php

user-profile-item.tpl.php

template_preprocess_user_profile()

1 theme call to user-profile.tpl.php
user_view in modules/user/user.pages.inc
Menu callback; Displays a user or user profile page.

File

modules/user/user-profile.tpl.php
View source
  1. <?php
  2. /**
  3. * @file user-profile.tpl.php
  4. * Default theme implementation to present all user profile data.
  5. *
  6. * This template is used when viewing a registered member's profile page,
  7. * e.g., example.com/user/123. 123 being the users ID.
  8. *
  9. * By default, all user profile data is printed out with the $user_profile
  10. * variable. If there is a need to break it up you can use $profile instead.
  11. * It is keyed to the name of each category or other data attached to the
  12. * account. If it is a category it will contain all the profile items. By
  13. * default $profile['summary'] is provided which contains data on the user's
  14. * history. Other data can be included by modules. $profile['user_picture'] is
  15. * available by default showing the account picture.
  16. *
  17. * Also keep in mind that profile items and their categories can be defined by
  18. * site administrators. They are also available within $profile. For example,
  19. * if a site is configured with a category of "contact" with
  20. * fields for of addresses, phone numbers and other related info, then doing a
  21. * straight print of $profile['contact'] will output everything in the
  22. * category. This is useful for altering source order and adding custom
  23. * markup for the group.
  24. *
  25. * To check for all available data within $profile, use the code below.
  26. * @code
  27. * print '<pre>'. check_plain(print_r($profile, 1)) .'</pre>';
  28. * @endcode
  29. *
  30. * Available variables:
  31. * - $user_profile: All user profile data. Ready for print.
  32. * - $profile: Keyed array of profile categories and their items or other data
  33. * provided by modules.
  34. *
  35. * @see user-profile-category.tpl.php
  36. * Where the html is handled for the group.
  37. * @see user-profile-item.tpl.php
  38. * Where the html is handled for each item in the group.
  39. * @see template_preprocess_user_profile()
  40. */
  41. ?>
  42. <div class="profile">
  43. <?php print $user_profile; ?>
  44. </div>

Comments

In addition to the $user_profile and $profile variables you can also use the variable $account in user-profile.tpl.php to get raw user data without the markup.

Bingo!!!

You made my day. I was looking for this.

Thanks

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!

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?

I just can't get the dpm to work on the user profile form, can anyone ellborate the answer to follow the steps?

thanks so much

nico