LLMS_Notification_Controller_Quiz_Failed::get_test_settings( string $type )

Get an array of LifterLMS Admin Page settings to send test notifications.


Parameters Parameters

$type

(string) (Required) Notification type [basic|email].


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/notifications/controllers/class.llms.notification.controller.quiz.failed.php

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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
public function get_test_settings( $type ) {
 
    if ( 'email' !== $type ) {
        return array();
    }
 
    $query    = new LLMS_Query_Quiz_Attempt(
        array(
            'per_page' => 25,
            'status'   => 'fail',
        )
    );
    $options  = array(
        '' => '',
    );
    $attempts = array();
    $results  = $query->get_results();
    if ( $query->has_results() ) {
        foreach ( $query->get_attempts() as $attempt ) {
            $quiz    = llms_get_post( $attempt->get( 'quiz_id' ) );
            $student = llms_get_student( $attempt->get( 'student_id' ) );
            if ( $attempt && $student ) {
                $options[ $attempt->get( 'id' ) ] = esc_attr( sprintf( __( 'Attempt #%1$d for Quiz "%2$s" by %3$s', 'lifterlms' ), $attempt->get( 'id' ), $quiz->get( 'title' ), $student->get_name() ) );
            }
        }
    }
    return array(
        array(
            'class'             => 'llms-select2',
            'custom_attributes' => array(
                'data-allow-clear' => true,
                'data-placeholder' => __( 'Select a failed quiz', 'lifterlms' ),
            ),
            'default'           => '',
            'id'                => 'attempt_id',
            'desc'              => '<br/>' . __( 'Send yourself a test notification using information from the selected quiz.', 'lifterlms' ),
            'options'           => $options,
            'title'             => __( 'Send a Test', 'lifterlms' ),
            'type'              => 'select',
        ),
    );
}


Top ↑

Changelog Changelog

Changelog
Version Description
6.1.0 Fixed access of protected LLMS_Abstract_Query properties. Fixed issue where void was returned instead of an empty array if the type was 'email'.
3.24.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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