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.
Return Return
(WP_Error|object) Object containing the meta values by name, otherwise WP_Error object.
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; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |