Home Forums Event Espresso Premium Custom Ordered CSV Columns Issue

Custom Ordered CSV Columns Issue

Posted: January 29, 2018 at 10:49 am


January 29, 2018 at 10:49 am

I am running into an odd issue when using custom ordering of CSV columns from user registrations. The ordering is working fine but when a question is removed from a group that my custom CSV columns array has in it, the csv will export that column with a number in the column (I’m assuming the index of the question).

So for example if my custom columns are id, name, and height and I remove the height question, in my CSV the height column will still export and populate with 3 on all registrations.

I am using the filter FHEE__EE_Export__report_registrations__reg_csv_array and passing it an ordered array to list the columns

You can view my code in this pastebin.

So I have a couple questions. Is it possible to just set these missing columns to return nil/an empty string instead of the question index OR only export the data column IF that question actually exists as part of the registration questions?

Thank you for your time.


  • Support Staff

January 29, 2018 at 3:21 pm

Hi there,

That an interesting problem I hadn’t thought of when creating that snippet.

The number you can see if the index of the allowed_fields_in_order array, once its flipped (using array_flip()) so that fields you set are used for the keys, the numeric index becomes the value, then array_merge is using the value.

So the simplest fix is to set the value of each element in the allowed_fields_in_order array to an empty string so even if the value is used its empty.

I’ve updated my code here:

If you copy the highlighted section from my code and replace the code in your snippet with that (basically everything outside of creating your order array) it should fix the problem for you.


January 30, 2018 at 12:10 pm

That worked great! Thank you for your assistance.


  • Support Staff

January 30, 2018 at 2:11 pm

You’re most welcome, I’m glad that worked for you.

The support post ‘Custom Ordered CSV Columns Issue’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Tony 2 years, 3 months ago ago

Topic Tags



This topic is: not resolved
Do NOT follow this link or you will be banned from the site!