Skip to content

Instantly share code, notes, and snippets.

@kwcjr
Last active May 15, 2023 15:53
Show Gist options
  • Save kwcjr/1af340122e747bba706892eb7ca78097 to your computer and use it in GitHub Desktop.
Save kwcjr/1af340122e747bba706892eb7ca78097 to your computer and use it in GitHub Desktop.
Add site name to pdf report file.
/**
* Snippet Action: Add Site Name to pdf file.
* Snippet Type: MainWP Custom Dashboard CSS snippet.
* Snippet Author: Keith Crain ( MainWP.com )
*/
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 ) {
$website = MainWP\Dashboard\MainWP_DB::instance()->get_website_by_id( $site_id );
$suffix = date( 'Y-m-d' ); // 2020-11-11
return $website->name . '-' . 'managed-care-report' . '-' . $suffix . '.pdf';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment