User Template

user-profile.tpl.php file print user template. Get template file from modules/user/user-profile.tpl.php it's drupal core module's template file. Copy file from modules/user/user-profile.tpl.php and pest it into current theme's dirctory to customize it.

Simply print this code to print user fields <?php  print render($user_profile['field_name']); ?> where 'field_name' is machine name of field. but if you hide lable from "Display Fields" tab of content type customization from Drupal administration then you need to use <?php $elements['#account']->field_example['und'][0]['value'] ?>

Print field from Profile2 in user-profile.tpl.php

$uid = $elements['#account']->uid;
$singleuser = profile2_load_by_user($uid, 'single_user');
print drupal_render(field_view_field('profile2', $singleuser, 'field_machine_name', 'value')); 

Where 'single_user' is profile name.

If you created two(2) different user profiles by using Profile2 module then use below sample codes-

$uid = $elements['#account']->uid;
$singleuser = profile2_load_by_user($uid, 'single_user');
$groupuser = profile2_load_by_user($uid, 'group_user');
if ($singleuser) {
$livein = drupal_render(field_view_field('profile2', $singleuser, 'field_location_pref', 'value'));
if ($groupuser) {
$livein = drupal_render(field_view_field('profile2', $groupuser, 'field_location_pref', 'value'));
/*$fullname = render($user_profile)['field_name'];*/
$fullname = $elements['#account']->field_name['und'][0]['value'];
echo '

Hi, My name is '.$fullname.' and I want to live in '.$livein.'

'; ?> Where 'single_user' and 'group_user' are two different user profiles created by Profile2 module. And 'field_location_pref' is field machine name of location field(from both profiles of Profile2 module) and 'field_name' is field's machine name from user account(not from profiles created by Profile2 module).


Sample blackbox block

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas non porta odio, id mattis erat.

Nam sed tincidunt eros. Donec a venenatis odio, vitae commodo sem. Vivamus ullamcorper pellentesque erat, in adipiscing tortor scelerisque sit amet. Nulla pulvinar urna magna. Vivamus a ipsum lorem. Etiam adipiscing pulvinar lorem.