Hello community,
I have managed to create some really cool reports to send to my clients, but I would like to know if I can change the default name of the .pdf attachment from pro-report-2020-12-15-6-7 (or whatever it happens to be at the time) to something a little more personalized, like monthly maintenance report, etc.
Thank you!
bogdan
(Bogdan Rapaić)
December 16, 2020, 12:23pm
2
Hi Ben,
thanks for reaching out.
Yes, it’s possible to customize report filenames by using the maiwnp_pro_reports_pdf_filename
filter. Here is an example:
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';
}
}
Thanks Bogdan, that’s very cool. Last question on this topic - In which file do I modify the code?
bogdan
(Bogdan Rapaić)
December 16, 2020, 1:18pm
4
Hi Ben, you are welcome.
You don’t have to modify the code in source files.
Basically, the best thing to do is the following:
Install the MainWP Custom Dashboard Extension
Go to the PHP section of this extension
Paste the code in there
Save Settings
However, if you prefer, you can always add this code to the functins.php file of the active theme on your Dashboard site.
system
(system)
Closed
December 17, 2020, 1:18pm
5
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.