lifterlms_template_achievements_loop( $student = null,  $limit = false,  $columns = null )


Source Source

File: includes/functions/llms.functions.templates.achievements.php

if ( ! function_exists( 'lifterlms_template_achievements_loop' ) ) {
	function lifterlms_template_achievements_loop( $student = null, $limit = false, $columns = null ) {

		// Get the current student if none supplied.
		if ( ! $student ) {
			$student = llms_get_student();
		}

		// Don't proceed without a student.
		if ( ! $student ) {
			return;
		}

		llms()->assets->enqueue_style( 'llms-iziModal' );
		llms()->assets->enqueue_script( 'llms-iziModal' );

		$cols     = $columns ? $columns : llms_get_achievement_loop_columns();
		$per_page = $cols * 5;

		// Get achievements.
		$query        = $student->get_achievements(
			array(
				'page'     => max( 1, get_query_var( 'paged' ) ),
				'per_page' => $limit ? min( $limit, $per_page ) : $per_page,
			)
		);
		$achievements = $query->get_awards();

		/**
		 * If no columns are specified and we have a specified limit
		 * and results and the limit is less than the number of columns
		 * force the columns to equal the limit.
		 */
		if ( ! $columns && $limit && $limit < $cols && $query->get_number_results() ) {
			$cols = $limit;
		}

		$pagination = 'dashboard' === LLMS_Student_Dashboard::get_current_tab( 'slug' ) ? false : array(
			'total'   => $query->get_max_pages(),
			'context' => 'student_dashboard',
		);

		llms_get_template(
			'achievements/loop.php',


Top ↑

User Contributed Notes User Contributed Notes

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