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.
Parameters Parameters
- $id
-
(int) (Required) WP_Post ID of a builder child object.
Return Return
(int) Parent course ID, or 0 if the relationship cannot be resolved.
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;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 10.0.1 | Introduced. |