LLMS_Student::is_complete( int $object_id, string $type = 'course' )
Determine if the student has completed a course, track, or lesson
Parameters Parameters
- $object_id
-
(int) (Required) WP Post ID of a course or lesson or section or the term id of the track
- $type
-
(string) (Optional) Object type (course, lesson, section, or track)
Default value: 'course'
Return Return
(boolean)
Source Source
File: includes/models/model.llms.student.php
public function is_complete( $object_id, $type = 'course' ) { // check tracks by progress // this is done because tracks can have the same id as another object... // @todo tracks should have a different table or format since the post_id col won't guarantee uniqueness... if ( 'course_track' === $type ) { $ret = ( 100 == $this->get_progress( $object_id, $type ) ); // Everything else can be checked on the postmeta table. } else { $query = new LLMS_Query_User_Postmeta( array( 'types' => 'completion', 'include_post_children' => false, 'user_id' => $this->get_id(), 'post_id' => $object_id, 'per_page' => 1, ) ); $ret = $query->has_results(); } return apply_filters( 'llms_is_' . $type . '_complete', $ret, $object_id, $type, $this ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |