apply_filters( 'learndash_quiz_completed_result_settings', array $quiz_result_settings, mixed $quiz_data )
Filters settings of the completed quiz results.
Description #
Parameters #
- $quiz_result_settings
-
(array) An array of quiz result settings data.
- $quiz_data
-
(mixed) An array of quiz data.
Source #
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php /** * Example usage for learndash_quiz_completed_result_settings filter. */ add_filter( 'learndash_quiz_completed_result_settings', function( $quiz_result_settings = array(), $quizdata = array() ) { // Example 1: If student has less then 60% don't show the 'View Questions' button. if ( ( isset( $quizdata['percentage'] ) ) && ( $quizdata['percentage'] < 60 ) ) { $quiz_result_settings['showViewQuestionButton'] = 0; } // Example 2: If student gets 100% don't show the quiz restart button. if ( ( isset( $quizdata['percentage'] ) ) && ( $quizdata['percentage'] == 100 ) ) { $quiz_result_settings['showRestartQuizButton'] = 0; } // Always return $quiz_result_settings return $quiz_result_settings; }, 30, 2 );