@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix content: <http://purl.org/rss/1.0/modules/content/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<https://lhero.org/portfolio/lh-mcp-buddypress-actions/>
  a sioc:Post ;
  dc:title "Profile fields" ;
  dcterms:identifier 154119 ;
  dc:modified "2026-11-08T18:34:16Z"^^xsd:dateTime ;
  dc:created "2026-11-08T18:34:16Z"^^xsd:dateTime ;
  sioc:link <https://lhero.org/portfolio/lh-mcp-buddypress-actions/profile-fields/> ;
  sioc:has_creator <https://lhero.org/author/1/#account> ;
  sioc:has_container <https://lhero.org/#posts> ;
  content:encoded """<ul class="lh_portfolio-meta"><li><strong>Part of:</strong> <a href="https://lhero.org/portfolio/lh-mcp-buddypress-actions/">LH MCP BuddyPress Actions</a></li></ul>
<p class="wp-block-paragraph">The xProfile abilities manage a site&#8217;s profile field groups and fields. Fields are per site on LocalHero (lh-buddypress-multi-network keeps the xProfile tables per site), so pass <code>site_id</code> to work on another site&#8217;s fields. All of them need <code>bp_moderate</code>; the writes default to a dry run.</p>



<h2 class="wp-block-heading">Settings schemas</h2>



<p class="wp-block-paragraph">BuddyPress field types only describe their settings as admin HTML. A type&#8217;s settings schema comes from its own <code>get_settings_schema()</code> when it has one (the proposed core change), otherwise from this plugin&#8217;s map, which covers datebox, wp-textbox and checkbox_acceptance. Types that save no settings get an empty schema; anything else is <code>unknown</code>, and its settings cannot be read or set here. <code>settings_schema_source</code> says which applies.</p>



<ul class="wp-block-list">

<li>Settings are checked against the schema before saving: wrong types, values outside an enum or range, and unknown keys are refused.</li>


<li>They are saved through the type&#8217;s own <code>admin_save_settings()</code>, in the shape the admin form posts. datebox relative years are signed (negative is in the past) and converted to BuddyPress&#8217;s years plus past or future. checkbox_acceptance only reads <code>$_POST</code>, so its page is written to field meta as it would write it.</li>


<li>On update, settings not given keep their values.</li>

</ul>



<h2 class="wp-block-heading">Options</h2>



<p class="wp-block-paragraph">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&#8217;s <code>xprofile_field_options_before_save</code> and <code>xprofile_field_default_before_save</code> filters, so a rename keeps them. Option IDs still change on every save; members&#8217; answers are kept, since they store the option name, which is why option names must be unique.</p>



<h2 class="wp-block-heading">What is refused</h2>



<ul class="wp-block-list">

<li>There is no delete ability.</li>


<li>A field&#8217;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.</li>


<li>A field whose type is not registered for the call cannot be updated, since saving it would lose its options and settings. With <code>site_id</code> this usually means the type comes from that site&#8217;s own plugins; use that site&#8217;s connector.</li>


<li>Required, visibility, signup position and autolink are refused for types that do not support them.</li>


<li>The fullname field must stay required and in the base group.</li>

</ul>



<h2 class="wp-block-heading">Order</h2>



<p class="wp-block-paragraph">New fields go at the end of their group. <code>reorder-xprofile-fields</code> 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.</p>



<h2 class="wp-block-heading">Hooks</h2>



<ul class="wp-block-list">

<li><code>lh_mcp_buddypress_actions_xprofile_settings_schemas</code> ( <code>$schemas</code> ): 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&#8217;s <code>get_field_settings()</code> if it has one, otherwise from field meta of the same name.</li>


<li><code>xprofile_fields_saved_field</code> is deliberately not fired. Plugins hook it to save their own admin form inputs from <code>$_POST</code>, and some delete what they stored when the input is missing (lh-profile-page&#8217;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.</li>

</ul>
"""^^rdf:XMLLiteral ;
  sioc:content """Part of: LH MCP BuddyPress Actions
The xProfile abilities manage a site&#8217;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&#8217;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&#8217;s settings schema comes from its own get_settings_schema() when it has one (the proposed core change), otherwise from this plugin&#8217;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&#8217;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&#8217;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&#8217;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&#8217; 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&#8217;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_id this usually means the type comes from that site&#8217;s own plugins; use that site&#8217;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&#8217;s get_field_settings() if it has one, otherwise from field meta of the same name.


xprofile_fields_saved_field is 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&#8217;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.


""" ;
  sioc:topic <https://lhero.org/?taxonomy=author&term=cap-1>, <https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261108t183500-bpa-profile-fields> .

<https://lhero.org/author/1/#account> rdfs:seeAlso <https://lhero.org/author/1/?feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=author&term=cap-1> rdfs:seeAlso <https://lhero.org/?taxonomy=author&term=cap-1&feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261108t183500-bpa-profile-fields> rdfs:seeAlso <https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261108t183500-bpa-profile-fields&feed=lhrdf&format=turtle> .
