LLMS_Lesson::is_orphan()
Determine if the lesson is an orphan
Contents
Return Return
(bool)
Source Source
File: includes/models/model.llms.lesson.php
public function is_orphan() {
$statuses = array( 'publish', 'future', 'draft', 'pending', 'private', 'auto-draft' );
foreach ( array( 'course', 'section' ) as $parent ) {
$parent_id = $this->get( sprintf( 'parent_%s', $parent ) );
if ( ! $parent_id ) {
return true;
} elseif ( ! in_array( get_post_status( $parent_id ), $statuses, true ) ) {
return true;
}
}
return false;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.4.0 | Use in_array() with strict comparison to decide whether the parent course/section post status is in a set of allowed statuses. |
| 3.14.8 | Introduced. |