ulgm_group_course_report_table_strings
Filters the localized strings used in the group course report table.
add_filter( 'ulgm_group_course_report_table_strings', $callback, 10, 1 );
Description
Filter the localized strings used in the group course report table. Developers can modify these strings to customize labels like "Select Course" and "No Course Available" for reporting purposes. This hook fires during the frontend report generation.
Usage
add_filter( 'ulgm_group_course_report_table_strings', 'your_function_name', 10, 1 );
Parameters
-
$localized_strings(mixed) - This parameter is an array containing localized strings used in the group course report table.
Return Value
The filtered value.
Examples
/**
* Example of adding a filter to modify the localized strings for the group course report table.
* This example demonstrates how to add a new string or modify an existing one.
*
* @param array $localized_strings The array of localized strings.
* @return array The modified array of localized strings.
*/
add_filter( 'ulgm_group_course_report_table_strings', function( $localized_strings ) {
// Example: Add a new string for a specific action in the report table.
$localized_strings['exportButtonLabel'] = __( 'Export Report Data', 'your-text-domain' );
// Example: Modify an existing string, perhaps to make it more specific.
if ( isset( $localized_strings['customizeColumns'] ) ) {
$localized_strings['customizeColumns'] = sprintf(
__( 'Tailor your %s view', 'your-text-domain' ),
LearnDash_Custom_Label::get_label( 'course' )
);
}
// Example: Add a nested string if the structure allows and it's needed.
// Assuming 'header' array exists and you want to add a new column header.
if ( ! isset( $localized_strings['header'] ) ) {
$localized_strings['header'] = array();
}
$localized_strings['header']['progress_status'] = __( 'Progress Status', 'your-text-domain' );
// Always return the modified array of strings.
return $localized_strings;
}, 10, 1 ); // 10 is the priority, 1 is the number of accepted arguments.
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/reports/group-reports-interface.php:996
private static function get_frontend_localized_strings() {
$localized_strings = array();
$localized_strings['selectCourse'] = sprintf( __( 'Select %s', 'uncanny-learndash-groups' ), LearnDash_Custom_Label::get_label( 'course' ) );
$localized_strings['noCourse'] = sprintf( __( 'No %s Available', 'uncanny-learndash-groups' ), LearnDash_Custom_Label::get_label( 'courses' ) );
$localized_strings['customizeColumns'] = __( 'Customize columns', 'uncanny-learndash-groups' );
$localized_strings['hideCustomizeColumns'] = __( 'Hide customize columns', 'uncanny-learndash-groups' );
$localized_strings['details'] = __( 'Details', 'uncanny-learndash-groups' );
$localized_strings['header']['user_name'] = __( 'Username', 'uncanny-learndash-groups' );
$localized_strings['header']['first_name'] = __( 'First Name', 'uncanny-learndash-groups' );
$localized_strings['header']['last_name'] = __( 'Last Name', 'uncanny-learndash-groups' );
$localized_strings['header']['user_email'] = __( 'Email', 'uncanny-learndash-groups' );
$localized_strings['header']['percent_completed'] = __( '% Complete', 'uncanny-learndash-groups' );
$localized_strings['header']['course_time'] = __( 'Course Time', 'uncanny-learndash-groups' );
$localized_strings['header']['date_completed'] = __( 'Date Completed', 'uncanny-learndash-groups' );
$localized_strings['header']['date_enrolled'] = __( 'Date Enrolled', 'uncanny-learndash-groups' );
$localized_strings['header']['course_name'] = sprintf( _x( '%s Name', 'LearnDash: Course Name', 'uncanny-learndash-groups' ), learndash_get_custom_label( 'course' ) );
$localized_strings['header']['group_name'] = sprintf( _x( '%s Name', 'LearnDash: Group Name', 'uncanny-learndash-groups' ), learndash_get_custom_label( 'group' ) );
$localized_strings['header']['transcript_page_url'] = __( 'Transcript', 'uncanny-learndash-groups' );
/* DataTable */
$localized_strings = array_merge( $localized_strings, Utilities::i18n_datatable_strings() );
$localized_strings['searchPlaceholder'] = __( 'Search by username, name, email or date', 'uncanny-learndash-groups' );
$localized_strings = apply_filters_deprecated( 'group-report-table-strings', array( $localized_strings ), '4.3.1', 'ulgm_group_course_report_table_strings' );
$localized_strings = apply_filters( 'ulgm_group_course_report_table_strings', $localized_strings );
return $localized_strings;
}