Events Made Easy › Forums › How do I … › Change CSV Export Headings
Tagged: CSV export
- This topic has 7 replies, 2 voices, and was last updated 3 years, 8 months ago by Anonymous.
-
AuthorPosts
-
Thu 25 Feb 2021 at 16:57 #62119AnonymousInactive
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
CharlotteThu 25 Feb 2021 at 17:05 #62120FrankyKeymasterThe same filter (eme_csv_column_filter) applies to the column headings line too.
Thu 25 Feb 2021 at 17:25 #62121AnonymousInactiveI’m struggling Franky, I’ll happily pay you for your time if you can help me get this right.
Thu 25 Feb 2021 at 17:41 #62122FrankyKeymasterAnd 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);
Thu 25 Feb 2021 at 17:54 #62123AnonymousInactiveThank 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.
Thu 25 Feb 2021 at 18:04 #62124AnonymousInactiveI 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.
Thu 25 Feb 2021 at 20:57 #62125FrankyKeymasterI 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).
Sun 28 Feb 2021 at 21:02 #62138AnonymousInactiveThank you so much for your help with this.
-
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.