learndash_ques_multiple_answer_pts_whole

apply_filters( 'learndash_ques_multiple_answer_pts_whole',  int $points,  array $question_data,  int|string $answer_index,  mixed $correct_answer,  array $user_response )

Filters points awarded for a multiple answer type question.


Description #

LearnDash multiple answer question, allow points to be allocated for not marking an incorrect answer. LearnDash Core loops over all the answers in a multiple answer question. If the user does not mark an incorrect answer, allow the possibility of giving them points.


Parameters #

$points

(int) Points awarded to quiz

$question_data

(array) An array of question data.

$answer_index

(int|string) Index of the answer.

$correct_answer

(mixed) Correct answer for the question.

$user_response

(array) An array of user response data.


Source #

File: includes/quiz/ld-quiz-pro.php


Examples #

 <?php
/**
 * Example usage for learndash_ques_multiple_answer_pts_whole filter.
 */
add_filter(
	'learndash_ques_multiple_answer_pts_whole',
	function( $points, $question_data, $answer_index, $correct_answer, $user_response ) {
		// May add any custom logic using $points, $question_data, $answer_index, $correct_answer, $user_response.

		// Always return $points.
		return $points;
	},
	10,
	5
);