Filter tin-canny-learndash-reporting

uo_tin_can_filter_group_label

Filters the label for the "Groups" filter in the Tin Can reporting.

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

Description

Filters the group label for Tin Can filter sections. This hook allows developers to customize the heading displayed for group-related filters within the Tin Can reporting interface, such as changing "Groups" to a more specific or localized term.


Usage

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

Return Value

The filtered value.


Examples

<?php
/**
 * Example: Customize the label for the "Groups" filter in the Tin Can reporting.
 *
 * This filter allows you to change the displayed text for the group filter,
 * for instance, to something more specific if your system uses different terminology.
 *
 * @param string $label The current label for the group filter.
 * @param bool   $default_value The default value passed to the filter.
 * @return string The modified label.
 */
add_filter( 'uo_tin_can_filter_group_label', 'my_custom_tin_can_group_label', 10, 2 );

function my_custom_tin_can_group_label( $label, $default_value ) {
    // Check if the default value is true, indicating we are likely processing the main group label.
    if ( true === $default_value ) {
        // Example: Change "Groups" to "Learner Groups"
        return __( 'Learner Groups', 'uncanny-learndash-reporting' );
    }

    // If it's not the default scenario, 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:104
src/reporting/xapi-quiz/templates/xapi-quiz-filter.php:112
src/reporting/tin-can/templates/tc-tincan-filter.php:108
src/reporting/tin-can/templates/tc-tincan-filter.php:116

<div class="reporting-tincan-filters-col reporting-tincan-filters-col--1">
                        <div class="reporting-tincan-section__title">
							<?php echo apply_filters( 'uo_tin_can_filter_section_heading', esc_html_x( 'User & Group', 'Tin Can Filter Group name', 'uncanny-learndash-reporting' ) ); ?>
                        </div>
                        <div class="reporting-tincan-section__content">
                            <div class="reporting-tincan-section__field">

                                <label for="tc_filter_group"><?php echo ucfirst( apply_filters( 'uo_tin_can_filter_group_label', esc_html_x( 'Groups', 'Tin Can Filter Group name', 'uncanny-learndash-reporting' ), true ) ); ?></label>
                                <select class="uo-admin-select" name="tc_filter_group" id="tc_filter_group">
                                    <option value="">
										<?php
										echo esc_html(
											sprintf(
											/* translators: %s: Group label */
												__( 'All %s', 'uncanny-learndash-reporting' ),


Scroll to Top