This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
Select which fields should be included or excluded from a quiz score.
Usage
add_filter( 'frm_quiz_score_field', 'frm_quiz_score_field', 10, 2 );
Parameters
- $count_field (boolean) - True if the field should be counted or false if it should not.
- $args (array)
- $args['field'] (object) - The field to be checked.
- $args['entry'] (object) - The entry being scored.
- $args['value'] (array|string) - The response in the field.
- $args['saved_answers'] (array) - A list of correct answers.
Examples
Exclude date field type
This example will exclude a field of date type from being counted in the score.
add_filter( 'frm_quiz_score_field', 'exclude_date_field_type', 10, 2 );
function exclude_date_field_type( $count_field, $args ) {
if ( $args['field']->type === 'date' ) {
$count_field = false;
}
return $count_field;
}
Replace the value 'date' in the if condition with the type of field you need to exclude from the score