Creating Custom User Profile Fields
BuddyPress provides an option to create custom fields by default. Custom fields help in collection and display of more user data. These fields can also be assigned to specific profile field groups in order to help in the proper organisation of user data.
Within this topic, we will look into how to create these profile fields and groups.
Setting Up a Field Group
Creation of a field group can be accomplished from the Users > Profile Fields > Add New Field Group section.
You will then need to add the field group name and description. Below is a sample on this:
Adding New Fields
Fields can be added from the Users > Profile Fields section. This can be done under a specific user group.
The Fields added to the Base group will be rendered on the registration field on the front-end.
Fields marked * are required fields and hence have to be field in by the users.
BuddyPress also provides various field types which include:
- Single Line Text Box
- Multi-line Text Area
- Date Selector
- Radio Buttons
- Dropdown Select Box
- Multiple Select Box
You can also specify the visibility settings of the fields to either everyone, admin only, my friends only or all members.
Adding More Field Types to your fields
BuddyPress only provides a few field types as highlighted above. You can however add more field types to your fields. This can be achieved using the BuddyPress Xprofile Custom Field Types plugin.
You will need to first install the plugin from the Plugins > Add New section.
Once you have the plugin installed, navigate to the Users > Profile Fields section and try editing an existing field or create a new field. You will notice there are some additional fields within the field type selection, of which include:
- Birthday Selector
- Checkbox Acceptance
Color (HTML5 field)
- Country Selector
- Custom Post Type Multiselector
- Custom Post Type selector
- Custom Taxonomy Multiselector
- Custom Taxonomy Selector
DatePicker (HTML5 field)
- Decimal Number (HTML5 field)
- Email (HTML5 field)
- From/To Values
- Number with min/max values (HTML5 field)
- Range Input (HTML5 field)
- Website (HTML5 field)
- oEmbed URL
Editing of field Values by Members
Members within the site can edit the field values from their profiles, and within the field group that the particular field belongs. A summary to this would be Profile > Edit > “Field Group Name” >”Field Name”.
Below is a sample screenshot of this: