Support

Home Forums Event Espresso Premium Custom Attendee Exports – Field Names

Custom Attendee Exports – Field Names

Posted: August 31, 2017 at 3:08 am

Viewing 6 reply threads


sweetrose500

August 31, 2017 at 3:08 am

As an add-on to this thread – https://eventespresso.com/topic/custom-attendee-exports-with-ee4/ – I have the code in place to only show specific fields and it works great. Is there a list somewhere of all the fields and their specific names so I can further tweak?

Thanks in advance.


Tony

  • Support Staff

August 31, 2017 at 3:48 am

Hi there,

Do you mean the field names from within the CSV or additional fields?

The CSV has the field names you can remove shown on row 1, you can copy the full field name from there and include it within the code you linked to.


sweetrose500

August 31, 2017 at 4:03 am

Thanks – ok, so I have the fields I want, however, when I export them to the CSV, they’re not in the order I set – is there a way to make sure the rows are in the order I want?


Tony

  • Support Staff

August 31, 2017 at 4:27 am

The functions you are using don’t set any order, you setup an array that tells the function which field to include/exclude from the CSV.

You’d need to change the order yourself within the function you are using, for example:

https://gist.github.com/Pebblo/d6cec7c4a1ff75e818097665108556fa

That uses array_merge() to filter the CSV row to match the order set in the $allowed_fields_in_order array.


sweetrose500

August 31, 2017 at 4:59 am

Thanks. Does it matter how the fields are defined? In the original version, I had them as: __( ‘Last Name[ATT_lname]’, ‘event_espresso’ ),, while in your version you have them as: __( ‘Last Name’, ‘event_espresso’ ) . ‘[ATT_lname]’.

If I need to use the version you outlined, what should I use as the third part of something like __( ‘comments’, ‘event_espresso’ )


Tony

  • Support Staff

August 31, 2017 at 5:12 am

It’s just building the column title but allowing for translations, so:

__( ‘Last Name[ATT_lname]’, ‘event_espresso’ ), is incorrect and will actually not work if your site is in another langauge.

__( ‘Last Name’, ‘event_espresso’ ) . ‘[ATT_lname]’. will work in another language.

The database column name (in this example [ATT_lname]) is not translated between sites, ‘Last Name’ would be. If you site is in English and always will be you don’t need the translation function at all, so you could have:

$allowed_fields_in_order = array(
	'Last Name[ATT_lname]',
	'First Name[ATT_fname]',
	'Email Address[ATT_email]',
);

If I need to use the version you outlined, what should I use as the third part of something like __( ‘comments’, ‘event_espresso’ )

In that example you would just have ‘comments’, if the CSV shows a DB column name next to the title, you need it in your function, if it doesn’t then you do not.


sweetrose500

August 31, 2017 at 5:30 am

Thank you! Extremely helpful.

Viewing 6 reply threads

The support post ‘Custom Attendee Exports – Field Names’ 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.

Event Espresso