2 new xProfile Field types will be introduced in BuddyPress 8.0.0

The BuddyPress xProfile component gives you the power to easily create as many profile fields as you wish and to organize these fields into groups of fields. So far there was only one field which was linked to an existing WordPress user field : the base Name field. This field’s data is synchronized with the WordPress user display name (unless you opt out this synchronization from the BuddyPress Options Administration screen).

WP xProfile field types are arriving!

In BuddyPress 8.0.0, you’ll have the extra power to include other WordPress fields into the xProfile groups of fields. This time, unlike what we’re doing for the Name field, we are not duplicating and synchronizing field values between the WordPress user field tables (the wp_users & the wp_usermeta ones) and the BuddyPress xProfile data table). Instead we are directly using the WordPress user field values.

Creating these new field types, we’ve also improved our xProfile field API so that you can now have more control about the features your custom type of field can support.

/**
 * Custom xProfile field type.
 */
class Custom_XProfile_Field_Type extends BP_XProfile_Field_Type {

	/**
	 * This property enforces Field's default visibility.
	 */
	public $visibility = 'public';

	/**
	 * Supported features for the WordPress field type.
	 */
	public static $supported_features = array(
		'required'                => false,
		'do_autolink'             => false,
		'allow_custom_visibility' => false,
		'member_types'            => false,
	);
}

Using the static $supported_features property, you can disable the corresponding features meta boxes from the xProfile Administration Screen. The above example is showing the supported features by the WordPress fields : as defined by WordPress, these fields cannot be made required, cannot have their visibility changed for something different than public and cannot be restricted to a member type. Below are the values used by default for any xProfile field type.

A regular xProfile field can be made required, can be restricted to a specific member type, can be set to let members define the field data visibility and can be auto linked to a members search request about the field value.

1. wp-biography

The first type is specially designed to let you include the biographical information of the user into the group of xProfile fields of your choice.

2. wp-textbox

Using this type of field, you can insert the first name, the last name, the website URL and the potential WordPress User Contact Methods you added. Once you created your wp-textbox field, you’ll just need to use the advanced meta box below the field’s description textarea to select the information to include into the group of fields of your choice.

Watch the demo!

The video below will show you how to create a new field to add/edit the Member’s website URL and the Biographical information directly from their front-end profile.

If you want to read the full story about these new xProfile field types, head over to this ticket on our Trac environment.

#8-0-0, #wordpress, #xprofile