LLMS_REST_Instructors_Controller::update_additional_data( int $object_id, array $prepared, WP_REST_Request $request )

Updates additional information not handled by WP Core insert/update user functions.

Parameters Parameters


(int) (Required) WP User id.


(array) (Required) Prepared item data.


(WP_REST_Request) (Required) Request object.

Top ↑

Return Return


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-instructors-controller.php

	protected function update_additional_data( $object_id, $prepared, $request ) {

		$object = parent::update_additional_data( $object_id, $prepared, $request );

		if ( is_wp_error( $object ) ) {
			return $object;

		// Add a parent_id of the current user when creating an instructors_assistant.
		// @todo: this should actually be handled by a `parent_ids` create/update arg required when assistant is a supplied role.
		if ( get_current_user_id() !== $object_id && ! empty( $prepared['roles'] ) && in_array( 'instructors_assistant', $prepared['roles'], true ) ) {
			$object->add_parents( get_current_user_id() );

		return $object;


Top ↑

Changelog Changelog

Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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