LLMS_Quiz_Legacy::get_course( $user_id = null )
Retrieve the course associated with the lesson
Description Description
Return Return
(obj|null) Instance of the LLMS_Course or null
Source Source
File: includes/class.llms.quiz.legacy.php
public function get_course( $user_id = null ) { if ( ! $user_id ) { $user_id = get_current_user_id(); } $lesson_id = $this->get_assoc_lesson( $user_id ); // this handles getting the lesson when the quiz hasn't been saved yet or has just been started if ( ! $lesson_id ) { $session = LLMS()->session->get( 'llms_quiz' ); $lesson_id = ( $session && isset( $session->assoc_lesson ) ) ? $session->assoc_lesson : false; } if ( $lesson_id ) { $lesson = llms_get_post( $lesson_id ); return $lesson->get_course(); } return null; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: