Support

Home Forums Event Espresso Premium Custom Field – Registration Display

Custom Field – Registration Display

Posted: July 12, 2018 at 7:44 am


Mel

July 12, 2018 at 7:44 am

We register teams by their pre-assigned team number. We need that team number (custom field) to be on the registrations table and be sortable. What is the best way to accomplish this.


Tony

  • Support Staff

July 12, 2018 at 2:27 pm

Hi Mel,

By custom field, I’m assuming you mean a custom EE registration question?

If so then so do the above you’re going to need to be pretty comfortable with PHP, I have an example snippet to get you started but its not going to work out of the box, you’ll need to customize the code to work for your specific use case.

Take a look here:

https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245

At a minimum you’ll need to change line 12:
https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245#file-example-php-L12

You can likely remove lines 16-20:
https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245#file-example-php-L16-L20
(It adds a custom field to the ‘contact’ table)

Line 29: https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245#file-example-php-L29

Thats the ID for the question you want to pull the data from.

Line 38: https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245#file-example-php-L38
(The filter uses the column key set on line 12, if you changed it from ‘custom-reg-qst-column’ then the filter needs to match whatever you set it to)

Line 44: https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245#file-example-php-L44

To tell EE that the column key should be sortable (again it should match what you set as the key on line 12)

And finally (iirc) line 56: https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245#file-example-php-L56

To tell EE how it should be sorted when that column is selected.

If none of the above makes any sense you’ll need some help from developer to help work through the example and set this up for you.


Mel

July 19, 2018 at 1:29 pm

Thanks. Where does this code get placed and called?


Tony

  • Support Staff

July 19, 2018 at 2:48 pm

You can add it to a custom functions plugin, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

The support post ‘Custom Field – Registration Display’ 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