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 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 Parameters
- $object
-
(Required) The WordPress user object.
- $request
-
(Required) Full details about the request.
Return Return
(bool|WP_Error) True on success, WP_Error object if a field cannot be updated.
Source Source
File: bp-members/classes/class-bp-rest-members-endpoint.php
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.', 'buddypress' ) );
}
$member = $object->data;
$member->id = $member->ID;
return WP_REST_Controller::update_additional_fields_for_object( $member, $request );
}
Changelog Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |