public/wordpress/wp-content/plugins/wp-courseware/includes/core/shortcodes.php
/**
	 * Course Next Available Unit Shortcode.
	 *
	 * examples:
	 *  - [wpcourse_next_available_unit course="1" text="Next Unit" class="next-unit" /]
	 *
	 * @since 4.6.0
	 *
	 * @param array  $atts The shortcode attributes.
	 * @param string $content The shortcode content.
	 *
	 * @return string The course progress bar html string.
	 */
Course Next Available Unit Shortcode.



@param array  $atts The shortcode attributes.
@param string $content The shortcode content.

@return string The course progress bar html string.
Course Next Available Unit Shortcode . @param array $atts The shortcode attributes . @param string $content The shortcode content . @return string The course progress bar html string .
public function course_next_available_unit_shortcode( $atts, $content = '' ) {
		$shortcode_atts = shortcode_atts( array(
			'course' => 0,
			'text'   => esc_html__( 'Next Unit', 'wp-courseware' ),
			'class'  => false,
		), $atts );
		if ( ! $shortcode_atts['course'] || ! is_user_logged_in() ) {
			return;
		}
		$student_id = get_current_user_id();
		$course_id  = absint( $shortcode_atts['course'] );
		$next_available_unit_id = wpcw_get_student_progress_next_course_unit( $student_id, $course_id, 'id' );
		if ( ! $next_available_unit_id ) {
			return;
		}
		return apply_filters( 'wpcw_course_next_available_unit_shortcode_html', sprintf(
			'<a href="%1$s"%2$s>%3$s</a>',
			get_post_permalink( $next_available_unit_id ),
			$shortcode_atts['class'] ? sprintf( ' class="%s"', esc_attr( $shortcode_atts['class'] ) ) : '',
			wp_kses_post( $shortcode_atts['text'] )
		), $shortcode_atts, $next_available_unit_id );
	}
public function course_next_available_unit_shortcode ( $ atts , $ content = '' ) { $ shortcode_atts = shortcode_atts ( array ( 'course' => 0 , 'text' => esc_html__ ( 'Next Unit' , 'wp-courseware' ) , 'class' => false , ) , $ atts ) ; if ( ! $ shortcode_atts [ 'course' ] || ! is_user_logged_in ( ) ) { return ; } $ student_id = get_current_user_id ( ) ; $ course_id = absint ( $ shortcode_atts [ 'course' ] ) ; $ next_available_unit_id = wpcw_get_student_progress_next_course_unit ( $ student_id , $ course_id , 'id' ) ; if ( ! $ next_available_unit_id ) { return ; } return apply_filters ( 'wpcw_course_next_available_unit_shortcode_html' , sprintf ( '<a href="%1$s"%2$s>%3$s</a>' , get_post_permalink ( $ next_available_unit_id ) , $ shortcode_atts [ 'class' ] ? sprintf ( ' class="%s"' , esc_attr ( $ shortcode_atts [ 'class' ] ) ) : '' , wp_kses_post ( $ shortcode_atts [ 'text' ] ) ) , $ shortcode_atts , $ next_available_unit_id ) ; }
Course Next Available Unit Shortcode.
Course Next Available Unit Shortcode .
// Check for courses. /** @var Unit $next_available_unit */ /**
		 * Fitler: Next Available Unit Shortcode Html.
		 *
		 * @since 4.6.0
		 *
		 * @param string The next available unit shortcode html.
		 * @param array $shortcode_atts The shortcode attributes.
		 * @param int   $next_available_unit_id The next available unit id.
		 *
		 * @return string The next available unit shortcode html.
		 */