The xProfile abilities manage a site’s profile field groups and fields. Fields are per site on LocalHero (lh-buddypress-multi-network keeps the xProfile tables per site), so pass site_id to work on another site’s fields. All of them need bp_moderate; the writes default to a dry run.
Settings schemas
BuddyPress field types only describe their settings as admin HTML. A type’s settings schema comes from its own get_settings_schema() when it has one (the proposed core change), otherwise from this plugin’s map, which covers datebox, wp-textbox and checkbox_acceptance. Types that save no settings get an empty schema; anything else is unknown, and its settings cannot be read or set here. settings_schema_source says which applies.
- Settings are checked against the schema before saving: wrong types, values outside an enum or range, and unknown keys are refused.
- They are saved through the type’s own
admin_save_settings(), in the shape the admin form posts. datebox relative years are signed (negative is in the past) and converted to BuddyPress’s years plus past or future. checkbox_acceptance only reads$_POST, so its page is written to field meta as it would write it. - On update, settings not given keep their values.
Options
BuddyPress deletes every option of a field whenever the field is saved and re-creates them from the admin form. These abilities supply the options through BuddyPress’s xprofile_field_options_before_save and xprofile_field_default_before_save filters, so a rename keeps them. Option IDs still change on every save; members’ answers are kept, since they store the option name, which is why option names must be unique.
What is refused
- There is no delete ability.
- A field’s type cannot change once it has rows in the xProfile data table, for types that keep their data elsewhere (the WordPress-backed types, and any type not from BuddyPress itself), or for the fullname field.
- A field whose type is not registered for the call cannot be updated, since saving it would lose its options and settings. With
site_idthis usually means the type comes from that site’s own plugins; use that site’s connector. - Required, visibility, signup position and autolink are refused for types that do not support them.
- The fullname field must stay required and in the base group.
Order
New fields go at the end of their group. reorder-xprofile-fields takes every field in a group, plus any to move in from another group, and gives each an explicit position, so fields that share a position (and come back in an unstable order) are separated.
Hooks
lh_mcp_buddypress_actions_xprofile_settings_schemas($schemas): add a JSON schema, keyed by field type, for a type with settings that does not describe them itself. Each property is read from the type’sget_field_settings()if it has one, otherwise from field meta of the same name.xprofile_fields_saved_fieldis deliberately not fired. Plugins hook it to save their own admin form inputs from$_POST, and some delete what they stored when the input is missing (lh-profile-page’s gender default, for one). The field cache it clears is cleared directly. Settings other plugins add to the Profile Fields screen are therefore left untouched.

