Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save Pebblo/efd134829ac8be1443b3 to your computer and use it in GitHub Desktop.

Select an option

Save Pebblo/efd134829ac8be1443b3 to your computer and use it in GitHub Desktop.
EE3 [LISTATTENDEES] shortcode that includes a call to include details of the seat the attende has booked. $seatingchart_tag, $seatingchart_seat, $seatingchart_row, $seatingchart_section are all set to empty strings and then the seat number is used to pull in the information from the seating table, this is then assigned to the variables mentioned…
<?php
//List Attendees Template
//Show a list of attendees using a shortcode
//[LISTATTENDEES]
//[LISTATTENDEES limit="30"]
//[LISTATTENDEES show_expired="false"]
//[LISTATTENDEES show_deleted="false"]
//[LISTATTENDEES show_secondary="false"]
//[LISTATTENDEES show_gravatar="true"]
//[LISTATTENDEES paid_only="true"]
//[LISTATTENDEES show_recurrence="false"]
//[LISTATTENDEES event_identifier="your_event_identifier"]
//[LISTATTENDEES category_identifier="your_category_identifier"]
//Please refer to this page for an updated lsit of shortcodes: http://eventespresso.com/forums/?p=592
/*Example CSS for your themes style sheet:
li.attendee_details{
display:block;
margin-bottom:20px;
background: #ECECEC;
border:#CCC 1px solid;
}
.espresso_attendee{
width:400px;
padding:5px;
}
.espresso_attendee img.avatar{
float:left;
padding:5px;
}
.clear{
clear:both;
}
*/
//The following code displays your list of attendees.
//The processing for this function is managed in the shortcodes.php file.
if (!function_exists('event_espresso_show_attendess')) {
function event_espresso_show_attendess($sql,$show_gravatar,$paid_only, $sort=''){
//echo $sql;
global $wpdb,$this_is_a_reg_page;
$events = $wpdb->get_results($sql);
foreach ($events as $event){
$event_id = $event->id;
$event_name = stripslashes_deep($event->event_name);
/*if (!$this_is_a_reg_page){
$event_desc = do_shortcode(stripslashes_deep($event->event_desc));
}*/
//This variable is only available using the espresso_event_status function which is loacted in the Custom Files Addon (http://eventespresso.com/download/plugins-and-addons/custom-files-addon/)
$event_status = function_exists('espresso_event_status') ? ' - ' . espresso_event_status($event_id) : '';
//Example usage in the event title:
/*<h2><?php _e('Attendee Listing For: ','event_espresso'); ?><?php echo $event_name . ' - ' . $event_status?> </h2>*/
?>
<div class="<?php espresso_template_css_class('event_display_boxes','event-display-boxes ui-widget'); ?>">
<h2 class="<?php espresso_template_css_class('event_title','event_title ui-widget-header ui-corner-top'); ?>">
<?php _e('Attendee Listing For: ','event_espresso'); ?>
<?php echo $event_name . $event_status?></h2>
<div class="<?php espresso_template_css_class('event_data_display','event-data-display ui-widget-content ui-corner-bottom'); ?>">
<?php //echo wpautop($event_desc); ?>
<ol class="<?php espresso_template_css_class('attendee_list','attendee_list'); ?>">
<?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' OR payment_status='Refund') ":'';
$a_sql .= $sort;
//echo $a_sql;
$attendees = $wpdb->get_results($a_sql);
foreach ($attendees as $attendee){
$id = $attendee->id;
$lname = $attendee->lname;
$fname = $attendee->fname;
$city = $attendee->city;
$state = $attendee->state;
$country = $attendee->state;
$email = $attendee->email;
$gravatar = $show_gravatar == 'true'? get_avatar( $email, $size = '100', $default = 'http://www.gravatar.com/avatar/' ) : '';
$city_state = $city != '' || $state != '' ? '<br />' . ($city != '' ? $city :'') . ($state != '' ? ', ' . $state :' ') :'';
$seatingchart_tag = '';
$seatingchart_seat = '';
$seatingchart_row = '';
$seatingchart_section = '';
if (defined("ESPRESSO_SEATING_CHART")) {
if (class_exists("seating_chart")) {
if ( seating_chart::check_event_has_seating_chart($event_id)) {
$rs = $wpdb->get_row("select scs.* from ".EVENTS_SEATING_CHART_EVENT_SEAT_TABLE." sces inner join ".EVENTS_SEATING_CHART_SEAT_TABLE." scs on sces.seat_id = scs.id where sces.attendee_id = ".$id);
if ( $rs !== NULL ) {
$seatingchart_tag = $rs->custom_tag;
$seatingchart_seat = $rs->seat;
$seatingchart_row = $rs->row;
$seatingchart_section = $rs->section;
}
}
}
}
//These are example variables to show answers to questions
//$custom_question_1 = '<br />'.do_shortcode('[EE_ANSWER q="12" a="'.$id.'"]');
//$custom_question_2 = '<br />'.do_shortcode('[EE_ANSWER q="13" a="'.$id.'"]');
?>
<li class="<?php espresso_template_css_class('attendee_details','attendee_details'); ?>"> <span class="<?php espresso_template_css_class('espresso_attendee','espresso_attendee'); ?>"><?php echo $gravatar ?><?php echo stripslashes_deep($fname . ' ' . $lname) . ' - ' . 'Seat #' . $seatingchart_seat . ' | ' . 'Section: ' . $seatingchart_section . '</p>'; ?> </span>
<div class="clear"></div>
</li>
<?php
}
?>
</ol>
</div>
</div>
<?php
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment