Events Made Easy Forums How do I … Change CSV Export Headings

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #62119
    Anonymous
    Inactive

    Hi Franky,

    I need a very specific layout for the exported csv. I hope you can help me.
    Is it possible to change the column headings in the RSVP CSV export for the name / email fields?

    I can see there’s filters but I can’t see one for the column headings, I was thinking an alternative way might be to copy that data into a new custom field with the right name – but that might be even more complicated…

    Thanks for your help,
    best wishes
    Charlotte

    #62120
    Franky
    Keymaster

    The same filter (eme_csv_column_filter) applies to the column headings line too.

    #62121
    Anonymous
    Inactive

    I’m struggling Franky, I’ll happily pay you for your time if you can help me get this right.

    #62122
    Franky
    Keymaster

    And what exactly are you struggling with? The example at https://www.e-dynamics.be/wordpress/category/documentation/12-hooks-and-filters/ seems pretty clear to me for that filter. For the first line, just add an extra check on $line_nr==1.
    Since per line, the column starts at index 0, by default the index for last name is 1 and for email it is 9. So:

    function my_eme_csv_column_filter($line,$event,$line_nbr) {
       if ($line_nbr==1) {
          $out_line=$line;
          $out_line[1]="my custom header for last name";
          $out_line[9]="my custom header for email";
          return $out_line;
       }
    }
    add_filter('eme_csv_column_filter','my_eme_csv_column_filter',10,3);
    #62123
    Anonymous
    Inactive

    Thank you Franky – I put that in my functions.php, but It’s not working for me. I get an error

    The header line does change the headings as needed but the data isn’t there below.
    There’s a warning instead
    <b>Warning</b>: Invalid argument supplied for foreach() in http://www.my site….. /wp-content/plugins/events-made-easy/eme_functions.php</b> on line <b>2568</b><br />

    What I really really want is for one category of events I get a CSV download that has specific headers and with some columns excluded.

    #62124
    Anonymous
    Inactive

    I also have custom fields in the RSVP form which I can’t see in the headings when I add that function.

    All the headings that I can see are in a single cell.

    #62125
    Franky
    Keymaster

    I forgot to add the else-statement:

    function my_eme_csv_column_filter($line,$event,$line_nbr) {
       if ($line_nbr==1) {
          $out_line=$line;
          $out_line[1]="my custom header for last name";
          $out_line[9]="my custom header for email";
          return $out_line;
       } else {
          return $line;
       }
    }
    add_filter('eme_csv_column_filter','my_eme_csv_column_filter',10,3);

    And the CSV is delimited by what you define in your settings (default is ‘,’ so when opening that in excel or so, make sure to split on that).

    #62138
    Anonymous
    Inactive

    Thank you so much for your help with this.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top