LLMS_Quiz::get_lessons( string $return = 'ids' )
Retrieve lessons this quiz is assigned to
Description Description
Parameters Parameters
- $return
-
(string) (Optional) format of the return [ids|lessons]
Default value: 'ids'
Return Return
(array) array of WP_Post IDs (lesson post types)
Source Source
File: includes/models/model.llms.quiz.php
public function get_lessons( $return = 'ids' ) { global $wpdb; $query = $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_llms_assigned_quiz' AND meta_value = %d;", $this->get( 'id' ) ) ); // return just the ids if ( 'ids' === $return ) { return $query; } // setup lesson objects $ret = array(); foreach ( $query as $id ) { $ret[] = llms_get_post( $id ); } return $ret; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.12.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: