lifterlms_course_continue_button( $post_id = null,  $student = null,  $progress = null )


Source Source

File: includes/llms.template.functions.php

680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
        if ( $button ) {
            $html .= '<' . $tag . ' class="llms-button-primary llms-purchase-button"' . $href . '>' . __( 'Continue', 'lifterlms' ) . '(' . $progress . '%)</' . $tag . '>';
        }
 
        if ( $echo ) {
            echo $html;
        } else {
            return $html;
        }
    }
}
 
function llms_get_progress_bar_html( $percentage ) {
 
    $percentage = sprintf( '%s%%', $percentage );
 
    $html = '<div class="llms-progress">
        <div class="progress__indicator">' . $percentage . '</div>
        <div class="llms-progress-bar">
            <div class="progress-bar-complete" data-progress="' . $percentage . '"  style="width:' . $percentage . '"></div>
        </div></div>';
 
    return $html;
 
}
 
 
/**
 * Output a course continue button linking to the incomplete lesson for a given student.
 *
 * If the course is complete "Course Complete" is displayed.
 *
 * @since 3.11.1
 * @since 3.15.0 Unknown.
 * @since 7.1.0 Remove check on student existence, now included in the enrollment check.
 *
 * @param int          $post_id  WP Post ID for a course, lesson, or quiz.
 * @param LLMS_Student $student  Instance of an LLMS_Student, defaults to current student.
 * @param int          $progress Current progress of the student through the course.
 * @return void
 */
if ( ! function_exists( 'lifterlms_course_continue_button' ) ) {
 
    function lifterlms_course_continue_button( $post_id = null, $student = null, $progress = null ) {
 
        if ( ! $post_id ) {
            $post_id = get_the_ID();
            if ( ! $post_id ) {
                return '';
            }
        }
 
        $course = llms_get_post( $post_id );
        if ( ! $course || ! is_a( $course, 'LLMS_Post_Model' ) ) {
            return '';
        }
        if ( in_array( $course->get( 'type' ), array( 'lesson', 'quiz' ) ) ) {
            $course = llms_get_post_parent_course( $course->get( 'id' ) );
            if ( ! $course ) {


Top ↑

User Contributed Notes User Contributed Notes

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