<?php
echo 'Hi ' . bp_core_get_username( bp_loggedin_user_id() ) . ' – Account Type: ' . bp_get_profile_field_data( 'field=VALUE' );
?>
Note: VALUE should be the exact name of the field you want to use.
Thanks, it kinda works. Only if I’m viewing my profile page. If I view any other page on the site it doesn’t find the value and just displays: Account:
I am trying to run this in the header.php file of my template…
Ah yes of course.
Replace:
bp_get_profile_field_data( 'field=VALUE' )
With
xprofile_get_field_data( 'field=VALUE', bp_loggedin_user_id() )
Thanks again, just needed one slight tweak. Final code is as follows:
<?php echo 'Hi ' . bp_core_get_username( bp_loggedin_user_id() ) . ' – Account Type: ' . xprofile_get_field_data( 'FIELD NAME OR ID', bp_loggedin_user_id() ); ?>
Didn’t need the “field=” for xprofile… Works using either the field name or the id.
Hi .. ,
for over 6 months i search for this function.
I need a function to display: “bp_get_member_profile_data”
in activity-stream for each invidually user in activity-stream !!!!!!!!!!!!!
Yes, I know the different with bp_get_member_profile_data and xprofile_get_field_data !
It´s all crazy, but whatever.
If i put the this in custom-function.php, in example:
————————-
function show_extra_profile_fields() {
global $bp;
$myfield = xprofile_get_field_data( ‘City’, $bp->loggedin_user->id );
echo $myfield;
}
add_action( ‘my_test_action’, ‘show_extra_profile_fields’ );
—————–
And put this Code in activty – entry.php
<?php do_action( ‘my_test_action’, ‘show_extra_profile_fields’ ); ?>
——————–
It shows the City, but in all activies it shows my City !
Also logically, because i say: –>loggedin_user
But I need the function to display the invidually City for User in entry.php !!
Please Help!