LLMS_Blocks_Post_Instructors::update_callback( string $value, WP_Post $object, string $key )

Update instructor information for a given object.


Description Description


Parameters Parameters

$value

(string) (Required) Instructor data to add to the object (JSON).

$object

(WP_Post) (Required) WP_Post object.

$key

(string) (Required) name of the field.


Top ↑

Return Return

(null|WP_Error)


Top ↑

Source Source

File: vendor/lifterlms/lifterlms-blocks/includes/class-llms-blocks-post-instructors.php

	public function update_callback( $value, $object, $key ) {

		if ( ! current_user_can( 'edit_post', $object->ID ) ) {
			return new WP_Error(
				'rest_cannot_update',
				__( 'Sorry, you are not allowed to edit the object instructors.', 'lifterlms' ),
				array(
					'key'    => $name,
					'status' => rest_authorization_required_code(),
				)
			);
		}

		$obj = llms_get_post( $object );
		if ( $obj ) {
			$obj->instructors()->set_instructors( $value );
		}

		return null;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: