BP_REST_Members_Endpoint::update_additional_fields_for_object( WP_User $object, WP_REST_Request $request )

Updates the values of additional fields added to a data object.

Description

This function makes sure updating the field value thanks to the id property of the created/updated object type is consistent accross BuddyPress components.

Parameters

$object

(Required) The WordPress user object.

$request

(Required) Full details about the request.

Return

(bool|WP_Error) True on success, WP_Error object if a field cannot be updated.

Source

File: bp-members/classes/class-bp-rest-members-endpoint.php

931
932
933
934
935
936
937
938
939
940
941
942
943
protected function update_additional_fields_for_object( $object, $request ) {
    if ( ! isset( $object->data ) ) {
        return new WP_Error(
            'invalid_user',
            __( 'The data for the user was not found.', 'buddyboss' )
        );
    }
 
    $member     = $object->data;
    $member->id = $member->ID;
 
    return WP_REST_Controller::update_additional_fields_for_object( $member, $request );
}

Changelog

Changelog
Version Description
0.1.0 Introduced.

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.