WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Advanced Events Registration] CSV & Excel export filename with spaces (3 posts)

  1. brianstanfill
    Member
    Posted 4 years ago #

    I'm using the pro version.

    I noticed in Firefox 3.6.3, clicking CSV or Excel to export a list of attendees would break the filename if the event name includes spaces.

    For example, the event "2010 Chili Cookoff" would be presented for download as "'2010", with the leading single quote followed by the first whole word.

    In \event_regis.php, this line defines filename:
    $filename = $event_name."-Payments_". $today ;

    ... and this line writes the header
    header("Content-Disposition: attachment; filename='" .$filename .".csv'");

    I replaced the spaces with underscores to solve the issue. I think more sensitization should occur since event names may contain unfriendly characters (slashes, for example).

    $filename = str_replace(" ", "_", $event_name)."-Payments_". $today ;

    http://wordpress.org/extend/plugins/advanced-events-registration/

  2. DivaVocals
    Member
    Posted 4 years ago #

    Interesting.. I just updated to the same version of Firefox today, and I cannot replicate this same issue..

    So while I won't necessarily be making this change just yet (will be doing mor QAing of the plugin to determine if I need to make this change..)

    In the meantime, I wanted to ask something.. You state that you replaced the code on (or around) line 826 with this code:
    $filename = str_replace(" ", "_", $event_name)."-Payments_". $today ;

    shouldn't it in fact read this:
    $filename = str_replace(" ", "_", $event_name)."-Payments_". $today . ".xls";

  3. DivaVocals
    Member
    Posted 4 years ago #

    Let me try re-posting this with more detailed information (and better spelling I hope.. **LOL**):

    Interesting.. I just updated to the same version of Firefox today, and I cannot replicate this same issue.. All my Event names are just fine when I export.. The file names end up looking as I expect based on the code:
    [Event Name]-Payments_[Report Date]_[Report Time].xls

    So if I download a file today (04/10/2010 at 9:17 am) for an event titled "The 2nd Adult Cooking Class", the download file name would be:
    The 2nd Adult Cooking Class-Payments_2010-04-09_0917.xls

    So I won't necessarily be making this change just yet.. I will be doing more QAing of the plugin to determine if I need to make this change 1st..

    In the meantime, I wanted to ask something.. You state that you replaced the code on (or around) line 826 with this code:
    $filename = str_replace(" ", "_", $event_name)."-Payments_". $today ;

    shouldn't it in fact read this:
    $filename = str_replace(" ", "_", $event_name)."-Payments_". $today . ".xls";

Topic Closed

This topic has been closed to new replies.

About this Topic