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.
1 2 3 4 5 6 |
$args = array( 'field' => 'Field Name' 'user_id => 1, ); bp_profile_field_data( $args ); |
Parameters
The function accepts following parameters:
- field ( string | Required | Default: false )
- user_id ( Integer | Not Required | Defaults to bp_displayed_user_id() )
Returns
This buddypress function prints the value for corresponding field.
Usage
To retrieve the birthday of user having user_id 7, use following code.
1 2 3 4 |
//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.