uo_tincanny_question_analysis_report_distractor_label
Filters the label displayed for distractor answers in the Tincanny question analysis report.
add_filter( 'uo_tincanny_question_analysis_report_distractor_label', $callback, 10, 1 );
Description
Allows modification of the default "Distractor" label used for reporting columns. Developers can change the text or its format to better suit their needs in the Uncanny LearnDash Reporting question analysis.
Usage
add_filter( 'uo_tincanny_question_analysis_report_distractor_label', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Filters the label for distractor columns in the Uncanny Toolkit's Question Analysis Report.
* This allows for customization of the text used to label distractors.
*
* @param string $label The default label for distractor columns.
* @return string The modified label for distractor columns.
*/
add_filter( 'uo_tincanny_question_analysis_report_distractor_label', 'my_custom_distractor_label', 10, 1 );
function my_custom_distractor_label( $label ) {
// Example: Append ' (Incorrect Answer)' to the distractor label for clarity.
// This is useful if you want to specifically highlight that these are incorrect options.
$custom_label = sprintf( '%s (Incorrect Answer)', $label );
return $custom_label;
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/uncanny-question-analysis-report/question-analysis-report.php:826
private static function add_distractor_columns() {
$cols = array();
$i = 1;
while ( $i <= self::$total_distractors ) {
$cols[ 'distractor-' . $i ] = sprintf( '%s %s', apply_filters( 'uo_tincanny_question_analysis_report_distractor_label', __( 'Distractor', 'uncanny-learndash-reporting' ) ), $i );
$cols[ 'distractor-percent-' . $i ] = __( '%', 'uncanny-learndash-reporting' );
$i ++;
}
$colll = self::$columns;
$end_array = array_slice( $colll, - 2, 2, true );
$start_array = array_slice( $colll, 0, count( $colll ) - 2, true );
self::$columns = array_merge( $start_array, $cols, $end_array );
}