I'm theming the display of user profile information managed by profile2 using a custom template, user-profile.tpl.php. I want to hide specific profile2 fields, and also check the value of others. However, looking at the $user_profile, field values are nested deeply in a profile, under the $pid, so I'm not sure how to cleanly target these in a template. So, my questions:

  1. What is the best way to render a single profile2 field when working in a template?

  2. What is the best way to hide a given profile2 field?

It's easy to hide a profile, or the title for a profile:

$user_profile['profile_main']['#title'] = NULL;

But I'm not sure how to work with individual profile2 fields.

Note: based on http://drupal.org/node/1300460 (unanswered)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.