Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Admin_Builder::get_object_parent_course_id( int $id )

Resolve the parent course ID for a builder child object.


Description Description

Supports section, lesson, llms_quiz, and llms_question post types.


Top ↑

Parameters Parameters

$id

(int) (Required) WP_Post ID of a builder child object.


Top ↑

Return Return

(int) Parent course ID, or 0 if the relationship cannot be resolved.


Top ↑

Source Source

File: includes/admin/class.llms.admin.builder.php

	private static function get_object_parent_course_id( $id ) {

		$post_type = get_post_type( $id );

		if ( 'llms_question' === $post_type ) {
			$question = llms_get_post( $id );
			if ( ! $question || ! is_a( $question, 'LLMS_Question' ) ) {
				return 0;
			}
			$quiz = $question->get_quiz();
			if ( ! $quiz || ! is_a( $quiz, 'LLMS_Quiz' ) ) {
				return 0;
			}
			$course = $quiz->get_course();
			return $course ? absint( $course->get( 'id' ) ) : 0;
		}

		$course = llms_get_post_parent_course( $id );
		return $course ? absint( $course->get( 'id' ) ) : 0;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
10.0.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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