Filter tin-canny-learndash-reporting

uo_tin_can_filter_date_range_label

Filters the label displayed for the date range input in the Tin Can reporting.

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

Description

Filters the default 'Date Range' label used for the Tin Can filter in Uncanny LearnDash Reporting. Developers can modify this text to customize how the date range filter is presented to users, offering flexibility in localization or branding.


Usage

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

Return Value

The filtered value.


Examples

// Modify the label for the Date Range filter to include an emoji for visual emphasis.
add_filter( 'uo_tin_can_filter_date_range_label', function( $label ) {
    // Check if the current user has a specific capability to see the emoji version.
    if ( current_user_can( 'manage_options' ) ) {
        return $label . ' 📅'; // Append a calendar emoji.
    }
    // Otherwise, return the original label.
    return $label;
}, 10, 1 );

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:235
src/reporting/tin-can/templates/tc-tincan-filter.php:232

</div>
                        </div>

                    </div>

                    <div class="reporting-tincan-filters-col reporting-tincan-filters-col--4">
                        <div class="reporting-tincan-section__title">
							<?php apply_filters( 'uo_tin_can_filter_date_range_label', esc_html_x( 'Date Range', 'Tin Can Filter Date Range name', 'uncanny-learndash-reporting' ) ); ?>
                        </div>
                        <div class="reporting-tincan-section__content">
                            <div class="reporting-tincan-section__field">
                                <label>
                                    <input class="uo-admin-radio" name="tc_filter_date_range" value="last"
                                           type="radio" <?php echo esc_attr( empty( $tc_filter_date_range ) || 'last' === $tc_filter_date_range ? 'checked="checked"' : '' ); ?> />
									<?php esc_html_e( 'View', 'uncanny-learndash-reporting' ); ?>


Scroll to Top