Support

Home Forums Event Espresso Premium Extending "Attendee List"

Extending "Attendee List"

Posted: December 16, 2014 at 1:25 am


Matt

December 16, 2014 at 1:25 am

I would like to extend the attendee list shortcode by also displaying answers to other questions.

Please can you help with this? If you have information on the location of the files required?

Example of what is needed to display:

“First Name | Last Name | Category | Team”

Both Category & team are separate questions.


Matt

December 16, 2014 at 1:26 am

This is EE3.


Tony

  • Support Staff

December 16, 2014 at 4:00 am

Hi Matt,

The file you’ll want to edit is event-espresso/templates/attendee_list.php

If you copy that file to wp-content/uploads/espresso/templates/

Then edit it there your modifications will be safe from being overwritten by updates.

Looking within that file you will also see:

//$custom_question_1 = '
'.do_shortcode('[EE_ANSWER q="12" a="'.$id.'"]');

Which is an example of how to pull in custom answers for a specific question. Change q=”12″ to the ID of your questions and it will pull that from the database.

Does that help?


Matt

December 17, 2014 at 7:28 pm

I am assuming that the ID of the questions is the order/sequence number?
If not, where can I find the ID?

I’ve tried the above and it doesn’t change anything.
It is still showing:
First Name | Last Name
City | County

City & Country were q12 and q13


Matt

December 17, 2014 at 7:31 pm

*City &

    County

were q12 and q13


Tony

  • Support Staff

December 18, 2014 at 3:25 am

Hi Matt,

Apologies for not making that clear, the ID is the actual question ID rather than the order number.

If you edit the question within Event Espresso -> Questions, then look within the address bar your url will end similar to this:

/wp-admin/admin.php?page=form_builder&action=edit_question&question_id=13

Example – http://take.ms/ytco8

The question_id is the the value you need to add for ‘q’ in the shortcode above, in this example 13.


Matt

December 18, 2014 at 4:46 am

OK thank you, although it still is not displaying the correct answers.

Is this the correct code?

//These are example variables to show answers to questions
						//$custom_question_1 = '<br />'.do_shortcode('[EE_ANSWER q="17" a="'.$id.'"]');
						//$custom_question_2 = '<br />'.do_shortcode('[EE_ANSWER q="15" a="'.$id.'"]');


Tony

  • Support Staff

December 18, 2014 at 5:29 am

The // at the beginning tells PHP that the line is a comment.

//$custom_question_1 = ‘
‘.do_shortcode(‘[EE_ANSWER q=”17″ a=”‘.$id.'”]’);

Doesn’t actually run anything, the // needs to be removed.

It seems you have added custom questions for City and Country however the default system questions include Country and State (which can be renamed to City) which means the address information will use the correct system question throughout the plugin.

Are you only looking to add City and Country? If so I can provide an alternative way to do this.


Matt

December 18, 2014 at 5:55 am

Sorry, I should have made it clearer above.

Currently it is showing:
City & County/State

But – I want to remove those (also the number at the start) and show two custom questions.

I’d also like to sort by something else.


Tony

  • Support Staff

December 18, 2014 at 6:15 am

The number at the beginning is because the attendee list is output as an ordered list ‘ol’ element, change that to ul.

Remove the comment lines from the beginning of the custom question declarations and then use $custom_question_1 and $custom_question_2 within line 91 to output the answers to those questions.

You’ll likely need to move the placement around some to suit your needs, be here is an example – http://take.ms/hUF6r


Matt

December 18, 2014 at 6:30 am

Brilliant, thank you. This works and hopefully I can work out the placement editing.

Any idea how I might then be able to have it sorted in alphabetical order of a custom question?

e.g.
Sorted based on a custom question called “Rider Category” in alphabetical order, then secondary sorted by last name?


Josh

  • Support Staff

December 19, 2014 at 9:10 am

Hi Matt,

The sort happens in the query before the loop, which is where the answer values are grabbed one by one. One way to sort the list based on a custom question would be to add a JOIN on the answers table in the query, which is this part of the code:

$a_sql = "SELECT * FROM " . EVENTS_ATTENDEE_TABLE . " WHERE event_id='" . $event_id . "'";
$a_sql .= $paid_only == 'true'? " AND (payment_status='Completed' OR payment_status='Pending' OR payment_status='Refund') ":'';
$a_sql .= $sort;

Another way to do it would be to use JavaScript (a good readymade jQuery plugin that works nicely for this is the FooTables plugin).

Either option will involve some significant customization to the template


Matt

January 1, 2015 at 4:47 am

I’d like to get this sorted, but think its above me.
Is there anyone who might be able to help, if so, an idea of time/cost?


Dean

January 2, 2015 at 6:02 am

Hi,

It is unlikely something we could assist with directly, our developers are working flat out on other projects. We do however have a list of recommended developers here: https://eventespresso.com/developers/event-espresso-pros/


Matt

January 2, 2015 at 7:14 am

Someone managed to get this done for me, thanks for the tips.
[url]http://www.acycling.com/battle-beach-entered-riders/[/url]


Tony

  • Support Staff

January 2, 2015 at 7:36 am

Thank you for letting us know Matt 🙂

I will mark this thread resolved.

The support post ‘Extending "Attendee List"’ 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