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


Source Source

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

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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.