global $user;
$profile = profile2_by_uid_load($user-> uid, 'main');
//Get exact field names by printing the array.
//Get exact field names by printing the array.
print "<pre>"; print_r($profile); print "</pre>"; // to know yourm all fields name
//Example to print profile fields
//Example to print profile fields
print $profile->field_business_name[ 'und'][0]['value'];
print $profile->field_first_name[' und'][0]['value'];
print $profile->field_business_ address['und'][0]['value'];
print $profile->field_street_ address['und'][0]['value'];
print $profile->field_address_line_ 2['und'][0]['value'];
print $profile->field_country['und'] [0]['iso2'];
print $profile->field_state_ province_region['und'][0][' value']];
print $profile->field_city['und'][0] ['value']];
print $profile->field_postal_zip_ code['und'][0]['value']];
print $profile->field_phone['und'][ 0]['value'];
print $profile->field_fax_number[' und'][0]['value'];
No comments:
Post a Comment