dozent_get_question( $question_id )
Get single quiz question by question ID
Parameters
- $question_id
-
(Required)
Return
(array|bool|mixed|object|void|null)
Source
File: includes/quiz-functions.php
function dozent_get_question( $question_id ) { global $wpdb; $cache_key = "question_{$question_id}"; $question = wp_cache_get( $cache_key, 'quiz_question', true ); if ( false === $question ) { $question = $wpdb->get_row( "SELECT * FROM {$wpdb->dozent_quiz_questions} WHERE question_id = {$question_id} LIMIT 1; " ); if ( $question ) { $options = $wpdb->get_results( "SELECT * FROM {$wpdb->dozent_quiz_question_options} WHERE question_id = {$question_id} ORDER BY sort_order ASC ;" ); $question->options = $options; } wp_cache_set( $cache_key, $question, 'quiz_question' ); } return $question; }
Changelog
Version | Description |
---|---|
DozentLMS 1.0.0 | Introduced. |