uo_ceu_credit_report_column_titles
Filters the column titles displayed in the CEU credit report, allowing customization of the report's headers.
add_filter( 'uo_ceu_credit_report_column_titles', $callback, 10, 1 );
Description
Filters the titles for columns displayed in the Uncanny CEU credit report. Developers can modify these titles to customize the report's appearance or translate them. The default titles include User, Title, Date, CEUs Earned, and Total.
Usage
add_filter( 'uo_ceu_credit_report_column_titles', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
add_filter(
'uo_ceu_credit_report_column_titles',
'my_custom_ceu_report_columns',
10,
1
);
/**
* Customize the column titles for the Uncanny CEU credit report.
*
* This function adds a new column for 'Instructor' and renames 'total' to 'Overall Score'.
*
* @param array $columns An associative array of column slugs and their default titles.
* @return array The modified array of column titles.
*/
function my_custom_ceu_report_columns( $columns ) {
// Add a new column for the instructor, if available in the context (this is hypothetical)
// In a real scenario, you'd need to check if 'instructor' data is actually available and relevant
// for this specific report before adding it.
// For demonstration, we'll just add it.
$columns['instructor'] = __( 'Instructor', 'my-text-domain' );
// Rename the 'total' column to 'Overall Score' for better clarity.
if ( isset( $columns['total'] ) ) {
$columns['total'] = __( 'Overall Score', 'my-text-domain' );
}
// Remove the 'date' column if it's not needed for this custom report view.
unset( $columns['date'] );
return $columns;
}
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/course-report.php:1360
public function get_report_columns() {
if ( empty( $this->columns ) || ! is_array( $this->columns ) ) {
$columns = apply_filters(
'uo_ceu_credit_report_column_titles',
array(
'user' => __( 'User', 'uncanny-ceu' ),
'course' => __( 'Title', 'uncanny-ceu' ),
'date' => __( 'Date', 'uncanny-ceu' ),
'ceus_earned' => Utilities::credit_designation_label( 'plural', __( 'CEUs', 'uncanny-ceu' ) ),
'total' => __( 'Total', 'uncanny-ceu' ),
)
);
$this->set_column_config( $columns );
}
return $this->columns;
}