LLMS_Blocks_Post_Instructors::get_callback( array $obj, WP_REST_Request $request )

Retrieve instructor information for a give object.


Parameters Parameters

$obj

(array) (Required) Assoc. array of WP_Post data.

$request

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


Top ↑

Return Return

(WP_Error|object) Object containing the meta values by name, otherwise WP_Error object.


Top ↑

Source Source

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

	public function get_callback( $obj, $request ) {

		$ret = array();

		$obj = llms_get_post( $obj['id'] );
		if ( $obj ) {
			$ret = $obj->instructors()->get_instructors( false );
			foreach ( $ret as &$instructor ) {
				$name    = '';
				$student = llms_get_student( $instructor['id'] );
				if ( $student ) {
					$name = $student->get_name();
				}
				$instructor['name'] = $name;
			}
		}
		return $ret;

	}


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.