Hi,
I tried a code from another topic
add_filter( ‘mainwp_pro_reports_pdf_filename’, ‘mycustom_mainwp_pro_reports_pdf_filename’, 10, 3 );
function mycustom_mainwp_pro_reports_pdf_filename( $filename, $report, $site_id ) {
global $mainWPProReportsExtensionActivator;
$website = apply_filters( 'mainwp_getsites', $mainWPProReportsExtensionActivator->get_child_file(), $mainWPProReportsExtensionActivator->get_child_key(), $site_id );
if ( $website && is_array( $website ) ) {
$website = current( $website );
return $website['name'] . '-' . date( 'Y-m-d', $report->date_from ) . '-' . date( 'Y-m-d', $report->date_to ) . '.pdf';
}
return $filename;
}
This one doesn’t work because the global variable is not recognized, so nothing changes.
add_filter( 'mainwp_pro_reports_pdf_filename', 'mycustom_mainwp_pro_reports_pdf_filename', 10, 3 );
if ( !function_exists( 'mycustom_mainwp_pro_reports_pdf_filename' ) ) {
function mycustom_mainwp_pro_reports_pdf_filename( $filename, $report, $site_id ) {
return 'new-file-name.pdf';
}
}
This code works but there is not date
I did everything from the custom dashboard extension MainWP