Browse: Home / Hooks /

learndash_report_filename

apply_filters( 'learndash_report_filename',  string $report_file_name,  string $data_slug )

Filters data report file path.


Description #


Parameters #

$report_file_name

(string) The name of the report file path.

$data_slug

(string) The slug of the data in the CSV.


Source #

File: includes/admin/classes-data-reports-actions/class-learndash-admin-data-reports-user-courses.php


Examples #

Note: Extended code example below not guaranteed, you may need to consult with a developer

 <?php
/**
 * Example usage for learndash_report_filename filter.
 */
add_filter(
	'learndash_report_filename',
	function ( $ld_wp_upload_filename = '', $data_slug = '' ) {
		// Set this value to something to replace 'learndash'
		$REPLACE_STR = 'xxx';

		if ( ! empty( $REPLACE_STR ) ) {
			$dirname               = dirname( $ld_wp_upload_filename );
			$basename              = basename( $ld_wp_upload_filename );
			$basename              = str_replace( 'learndash', $REPLACE_STR, $basename );
			$ld_wp_upload_filename = $dirname . '/' . $basename;
		}

		// Always return
		return $ld_wp_upload_filename;
	},
	20,
	2
);
 

Changelog #

Changelog
Version Description
2.4.7 Introduced.