How to print out Profile fields

Last updated on
30 April 2025

This is a short tutorial how to print out the Profile fields in the author-pane.tpl. This is created for the issue #504478: How to print profile fields? to collect a doc page for all versions of the module.

NOTE! That this is fields from the Profile module, not Field module!

Drupal 5.x

Usage: $profile['category']['field_name']['value']
Example: <?php print $profile['Personal info']['profile_name']['value']; ?>

Drupal 6.x

Usage: $profile['category']['field_name']['#value']
Example: <?php print $profile['Personal info']['profile_name']['#value']; ?>

Drupal 7.x

In D7 all Profile fields are loaded into the user object so the $profile variable is removed in the tpl. Use the $account variable instead and be sure sure to use check_plain() on the value to not getting XSS vulnerability.

Usage: $account->form_name;
Example: <?php print check_plain($account->profile_name); ?>

Help improve this page

Page status: Not set

You can: