LLMS_Notification_Controller_Quiz_Graded::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]
Return Return
(array)
Source Source
File: includes/notifications/controllers/class.llms.notification.controller.quiz.graded.php
public function get_test_settings( $type ) {
if ( 'email' !== $type ) {
return;
}
$query = new LLMS_Query_Quiz_Attempt(
array(
'per_page' => 25,
)
);
$options = array(
'' => '',
);
$attempts = array();
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 && $quiz ) {
$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 passed 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',
),
);
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.24.0 | Introduced. |