bp_profile_field_data() – BuddyPress Function Reference

Description

bp_profile_field_data() is used to output the buddypress xProfile field data.  It can be used to retrieve data for any user by setting user_id parameter. The functions outputs the value of field to be used in your buddypress compatible theme.

$args = array(
    'field' => 'Field Name'
    'user_id => 1,
);

bp_profile_field_data( $args );

Parameters

The function accepts following parameters:

Returns

This buddypress function prints the value for corresponding field.

Usage

To retrieve the birthday of user having user_id 7, use following code.

//This function will print the value of field.
$args = array('field' => 'Birthday', 'user_id' => 7);

bp_profile_field_data( $args );

Additional Remarks

This BP function will output the data, if you want the profile data to be returned for use in PHP than use bp_get_profile_field_data() which accepts same parameters and return the field value.