LLMS_Quiz::is_orphan( bool $deep = false )
Determine if the quiz is an orphan.
Parameters Parameters
- $deep
-
(bool) (Optional) Whether or not deeply check this quiz is orphan. Default
false
. When set to true will ensure not only that this quiz as alesson_id
property set But also that the lesson with idlesson_id
has aquiz
property as equal as this quiz id.Default value: false
Return Return
(bool)
Source Source
File: includes/models/model.llms.quiz.php
public function is_orphan( $deep = false ) { $parent_id = $this->get( 'lesson_id' ); if ( ! $parent_id ) { return true; } /** * This is to take into account possible data inconsistency. * * @link https://github.com/gocodebox/lifterlms/issues/1039 */ if ( $deep ) { $lesson = llms_get_post( $parent_id ); // Both the ids are already absint, see LLMS_Post_Model::___get(). if ( ! $lesson || $this->get( 'id' ) !== $lesson->get( 'quiz' ) ) { return true; } } return false; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.2.0 | Added the $deep parameter. |
3.16.12 | Introduced. |