bp_profile_field_data() – BuddyPress Function Reference

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.

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.

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.

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.