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.


Top ↑

Parameters Parameters

$object

(WP_User) (Required) The WordPress user object.

$request

(WP_REST_Request) (Required) Full details about the request.


Top ↑

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 parent::update_additional_fields_for_object( $member, $request );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.