Filter tin-canny-learndash-reporting

uo_tin_can_filter_module_label

Filters the label used for the Tin Can filter module before it is displayed.

add_filter( 'uo_tin_can_filter_module_label', $callback, 10, 1 );

Description

Filters the label for the Tin Can module filter group. Developers can modify this string to change how the "Module" filter group is displayed in the Uncanny LearnDash Reporting interface, offering customization for reporting views.


Usage

add_filter( 'uo_tin_can_filter_module_label', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

<?php
/**
 * Example of how to filter the label for the "Module" filter in the Tin Can reporting.
 *
 * This function will change the default label 'Module' to 'Lesson' for the Tin Can module filter.
 *
 * @param string $label The original label for the filter.
 * @param mixed  $param_two The second parameter passed to the filter (currently unused in the core).
 * @return string The modified label for the filter.
 */
add_filter( 'uo_tin_can_filter_module_label', 'my_custom_tin_can_module_label', 10, 2 );

function my_custom_tin_can_module_label( $label, $param_two ) {
    // Check if the original label is what we expect, and if so, change it.
    if ( $label === esc_html_x( 'Module', 'Tin Can Filter Group name', 'uncanny-learndash-reporting' ) ) {
        return esc_html__( 'Lesson', 'your-text-domain' ); // Replace with your desired label
    }

    // If the label is not what we expect, return the original label.
    return $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/reporting/xapi-quiz/templates/xapi-quiz-filter.php:171
src/reporting/xapi-quiz/templates/xapi-quiz-filter.php:179
src/reporting/tin-can/templates/tc-tincan-filter.php:175
src/reporting/tin-can/templates/tc-tincan-filter.php:183

<?php echo esc_html( $course['course_name'] ); ?>
                                            </option>
		                                <?php } ?>
	                                <?php } ?>
                                </select>
                            </div>
                            <div class="reporting-tincan-section__field">
                                <label for="tc_filter_module"><?php echo ucfirst( apply_filters( 'uo_tin_can_filter_module_label', esc_html_x( 'Module', 'Tin Can Filter Group name', 'uncanny-learndash-reporting' ), false ) ); ?></label>
                                <select class="uo-admin-select" name="tc_filter_module" id="tc_filter_module">
                                    <option value="">
		                                <?php
		                                echo esc_html(
			                                sprintf(
			                                /* translators: %s: Course label */
				                                __( 'All %s', 'uncanny-learndash-reporting' ),


Scroll to Top