BP_REST_Account_Settings_Options_Endpoint::update_profile_fields( WP_REST_Request $request )
Update profile fields.
Description
Parameters
- $request
-
(Required) Full details about the request.
Return
(array|bool|void)
Source
File: bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php
public function update_profile_fields( $request ) { $post_fields = $request->get_param( 'fields' ); add_filter( 'bp_displayed_user_id', array( $this, 'bp_rest_get_displayed_user' ), 999 ); if ( ! empty( $post_fields ) ) { // Save the visibility settings. foreach ( $post_fields as $field => $value ) { $field_id = (int) str_replace( 'field_', '', $field ); if ( ! empty( $field_id ) && is_int( $field_id ) && ! empty( $value ) ) { $visibility_level = $value; xprofile_set_field_visibility_level( $field_id, bp_displayed_user_id(), $visibility_level ); } } } /** * Fires after saving xprofile field visibilities. * * @since 0.1.0 */ do_action( 'bp_xprofile_settings_after_save' ); remove_filter( 'bp_displayed_user_id', array( $this, 'bp_rest_get_displayed_user' ), 999 ); return array( 'error' => false, 'notice' => false, ); }
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.