LLMS_Lesson::is_orphan()

Determine if the lesson is an orphan


Return Return

(bool)


Top ↑

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;

	}

Top ↑

Changelog 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.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.