Posted: 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. |
|
This is EE3. |
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 = ' 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? |
|
|
I am assuming that the ID of the questions is the order/sequence number? I’ve tried the above and it doesn’t change anything. City & Country were q12 and q13 |
|
*City &
were q12 and q13 |
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. |
|
|
OK thank you, although it still is not displaying the correct answers. Is this the correct code?
|
The // at the beginning tells PHP that the line is a comment. //$custom_question_1 = ‘ 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. |
|
|
Sorry, I should have made it clearer above. Currently it is showing: 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. |
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 |
|
|
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. |
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 |
|
|
I’d like to get this sorted, but think its above me. |
|
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/ |
|
Someone managed to get this done for me, thanks for the tips. |
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.