Been trying to print the profile2 fields in the user-profile.tpl. The fields are of type: taxonomy reference field and link field.
The documentation provided in drupal doesn't work.
Workarounds provided in the profile2 issue queue here and here either prints the current users value in every profile or renders it twice.
It'll really great if someone can help me with this. Thanks for your time.
In user-profile.tpl the below renders the fields twice, once within the div and other without it from "print render($user_profile);"
<div class="athlete-info">
<?php $user_uid = $elements['#account']->uid;
$profile = profile2_load_by_user($user_uid, 'athlete');
print drupal_render(field_view_field('profile2', $profile, 'field_name', 'value'));
print drupal_render(field_view_field('profile2', $profile, 'field_twitter','value'));
print drupal_render(field_view_field('profile2', $profile, 'field_facebook', 'value'));
print drupal_render(field_view_field('profile2', $profile, 'field_role', 'value'));
?>
</div>
But this causes an error page on other user roles who don't have to fill up the athlete profile type. :(
EDIT: I am using the profile 2 module to create a profile called athlete with few extra fields like field_facebook,field_twitter and assign them to users of a particular role.