lifterlms_course_continue_button( $post_id = null, $student = null, $progress = null )
Contents
Source Source
File: includes/llms.template.functions.php
function lifterlms_course_progress_bar( $progress, $link = false, $button = true, $echo = true ) {
$progress = round( $progress, 2 );
$tag = ( $link ) ? 'a' : 'span';
$href = ( $link ) ? ' href=" ' . $link . ' "' : '';
$html = llms_get_progress_bar_html( $progress );
if ( $button ) {
$html .= '<' . $tag . ' class="llms-button-primary llms-purchase-button"' . $href . '>' . __( 'Continue', 'lifterlms' ) . '(' . $progress . '%)</' . $tag . '>';
}
if ( $echo ) {
echo wp_kses_post( $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 '';
}
}
Expand full source code Collapse full source code View on GitHub