From db965626dd3590bc8d8c35d042d4e88092ec9941 Mon Sep 17 00:00:00 2001 From: Paul Kevan <2290623+pkevan@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:36:17 +0100 Subject: [PATCH] Add site info the export filename (#1375) Fixes #1373. --- public_html/wp-content/plugins/camptix/camptix.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index 0a468ad87..2ad4dfa16 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -2772,7 +2772,12 @@ function export_admin_init() { 'csv' => 'text/csv', ); - $filename = sprintf( 'camptix-export-%s.%s', date( 'Y-m-d' ), $format ); + // Get some useful info to use as filename, to avoid confusion. + $site_info = WP_Site::get_instance( get_current_blog_id() ); + $domain = str_replace( '.', '-', $site_info->domain ); + $path = str_replace( '/', '', $site_info->path ); + + $filename = sprintf( 'camptix-export-' . $domain . '-' . $path . '-%s.%s', date( 'Y-m-d' ), $format ); header( 'Content-Type: ' . $content_types[$format] ); header( 'Content-Disposition: attachment; filename="' . $filename . '"' );