Skip to content

Commit

Permalink
Add site info the export filename (#1375)
Browse files Browse the repository at this point in the history
Fixes #1373.
  • Loading branch information
pkevan authored Sep 24, 2024
1 parent 6ea5c1b commit db96562
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public_html/wp-content/plugins/camptix/camptix.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '"' );
Expand Down

0 comments on commit db96562

Please sign in to comment.