Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Answers Shortcode | Event Espresso - Staging Server

Answers Shortcode

One of the new features that is included in Event Espresso 3.1 is the EE_ANSWER shortcode. This shortcode makes it possible to grab answers to custom questions without writing your own custom database queries. It’s been developed to work with the [LISTATTENDEES] shortcode to create customized attendee lists.
[s2If current_user_can(access_s2member_level1)]
Unlike many of the of the other shortcodes that ship with Event Espresso, this one is a bit different in that it’s designed primary to go into a display template. So in order to take advantage of this new feature, a little familiarity with a code editor and an FTP client is required.

First you’ll need a custom question to plug this into. Navigate to the manage questions screen and go to edit the custom question you’d like to include the answer to in the attendee list. Take note of the ID in the URL. This is how the answer will be identified in the next step.

Copy the attendee_list.php template file from the Event Espresso plugin’s /template directory over to /wp-content/uploads/espresso/templates. Open this file in your text editor of choice. Near the bottom of this template, you’ll find a block of PHP code that looks something like this:

<?php 
	$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') ":'';
	$a_sql .= $sort;
	//echo $a_sql;
	$attendees = $wpdb--->get_results($a_sql);
	foreach ($attendees as $attendee){
		$id = $attendee-&gt;id;
		$lname = $attendee-&gt;lname;
		$fname = $attendee-&gt;fname;
		$city = $attendee-&gt;city;
		$state = $attendee-&gt;state;
		$country = $attendee-&gt;state;
		$email = $attendee-&gt;email;
		$gravatar = $show_gravatar == 'true'? get_avatar( $email, $size = '100', $default = 'http://www.gravatar.com/avatar/' ) : '';
		$city_state = $city != '' || $state != '' ? '
' . ($city != '' ? $city :'') . ($state != '' ? ', ' . $state :' ') :'';

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

Note where we’ve uncommented out one of the examples of the EE_ANSWER shortcodes. Also note that the question ID has been placed between double quotes for the q parameter. The final step is to add the newly created custom question variable to the markup. In this example, we’ll add it near the end of the echo statement that’s already there:

<div class="espresso_attendee"><?php echo $gravatar ?><?php echo '<p><strong>' . stripslashes_deep($fname . ' ' . $lname) . '</strong><br />' . ($city != '' ? $city :'') . ($state != '' ? ', ' . $state :' ') . ($custom_question_1 != '' ? $custom_question_1 :'') . '</p>'; ?> </div>

Then add the [LISTATTENDEES] shortcode to page, post, or template with the event_identifier parameter to display a list of attendees along with their specified answer(s).[/s2If]
[s2If !current_user_can(access_s2member_level1)]

The page you are trying to access is reserved for registered Event Espresso Users and VIP Members. Please purchase a support license for Event Espresso, VIP access or log-in. If you think you are receiving this message in error, contact us.

[/s2If]


Need more help?

  • Browse or search for more information on this topic in our support forums. Customers with an active support license can open a support topic and get help from Event Espresso staff.
  • Have an emergency? Purchase a support token and get expedited one-on-one help!
  • Go back to documentation for Event Espresso
Event Espresso - Staging Server