uo_tincanny_reporting_skip_ceu_override_quiz_ids
Filters the quiz IDs that are excluded from CEU reporting, allowing custom overrides.
add_filter( 'uo_tincanny_reporting_skip_ceu_override_quiz_ids', $callback, 10, 1 );
Description
Filters the array of quiz IDs that should be skipped for CEU override calculations. This is useful for excluding specific quizzes from automated CEU adjustments. By default, it returns an empty array. Developers can modify this to include quiz IDs to bypass CEU overrides.
Usage
add_filter( 'uo_tincanny_reporting_skip_ceu_override_quiz_ids', 'your_function_name', 10, 1 );
Parameters
-
$quiz_id(mixed) - This parameter contains an array of quiz IDs that should be skipped for the CEU override.
Return Value
The filtered value.
Examples
add_filter( 'uo_tincanny_reporting_skip_ceu_override_quiz_ids', 'my_custom_skip_ceu_override_quiz_ids', 10, 2 );
/**
* Example function to skip CEU override for specific quiz IDs.
*
* This function demonstrates how to add specific quiz IDs to a list
* that should be skipped for CEU override reporting.
*
* @param array $skip_quiz_ids The current array of quiz IDs to skip.
* @param int $current_quiz_id The ID of the quiz currently being processed.
* @return array Modified array of quiz IDs to skip.
*/
function my_custom_skip_ceu_override_quiz_ids( $skip_quiz_ids, $current_quiz_id ) {
// Define an array of specific quiz IDs that should not have CEU overrides applied.
$specific_quizzes_to_skip = array( 123, 456, 789 );
// Merge the existing skip IDs with our specific ones.
$skip_quiz_ids = array_merge( $skip_quiz_ids, $specific_quizzes_to_skip );
// Optionally, if the current quiz ID is in a special category,
// you might want to always skip it, regardless of the predefined list.
// For example, if quizzes with a specific meta key should be skipped.
if ( get_post_meta( $current_quiz_id, '_my_special_skip_meta_key', true ) === 'yes' ) {
$skip_quiz_ids[] = $current_quiz_id;
}
// Ensure no duplicates and return only valid integer IDs.
return array_unique( array_map( 'absint', $skip_quiz_ids ) );
}
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/classes/ceu-tincanny-question-analysis.php:62
public function multiple_filters() {
if ( false === apply_filters( 'uo_tincanny_reporting_do_ceu_override', true ) ) {
return;
}
$quiz_id = ( isset( $_GET['quiz-id'] ) && 0 !== $_GET['quiz-id'] ) ? absint( $_GET['quiz-id'] ) : 0;
$skip_quiz_ids = apply_filters( 'uo_tincanny_reporting_skip_ceu_override_quiz_ids', array(), $quiz_id );
if ( ! empty( $skip_quiz_ids ) ) {
$skip_quiz_ids = array_map( 'absint', $skip_quiz_ids );
}
if ( in_array( $quiz_id, $skip_quiz_ids, true ) ) {
return;