Skip to content

Instantly share code, notes, and snippets.

@aldenrobinson
Created July 21, 2014 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aldenrobinson/2fce0cc05307503c8285 to your computer and use it in GitHub Desktop.
Save aldenrobinson/2fce0cc05307503c8285 to your computer and use it in GitHub Desktop.
Custom Espresso multi-query registration page
<?php
//This is the registration form.
//This is a template file for displaying a registration form for an event on a page.
//There should be a copy of this file in your wp-content/uploads/espresso/ folder.
?>
<div id="espresso-event-id-<?php echo $event_id; ?>">
<div id="event_espresso_registration_form" class="">
<div class="row">
<section class="medium-8 columns">
<?php
$ui_corner = 'ui-corner-all';
//This tells the system to hide the event title if we only need to display the registration form.
if ($reg_form_only == false) {
?>
<?php if (!empty($event_meta['event_thumbnail_url'])){?>
<img src="<?php echo $event_meta['event_thumbnail_url']; ?>">
<?php } ?>
<div class='row'>
<header class='small-12 columns'>
<div class='row'>
<div class='date small-3 medium-2 columns'>
<div class='row collapse'>
<time class='small-12 columns'>
<div class='row collapse'>
<div class='month small-12 columns'>
<?php echo $disp_month; ?>
</div>
</div>
<div class='row collapse'>
<div class='day small-12 columns'>
<?php echo $disp_day; ?>
</div>
</div>
<div class='row collapse'>
<div class='time small-12 columns'>
<?php echo $disp_time; ?>
</div>
</div>
</time>
</div>
</div>
<div class='small-9 medium-10 columns'>
<h2>
<?php echo $event_name ?> <?php echo $is_active['status'] == 'EXPIRED' ? ' - <span class="expired_event">Event Expired</span>' : ''; ?> <?php echo $is_active['status'] == 'PENDING' ? ' - <span class="expired_event">Event is Pending</span>' : ''; ?> <?php echo $is_active['status'] == 'DRAFT' ? ' - <span class="expired_event">Event is a Draft</span>' : ''; ?>
</h2>
</div>
</div>
</header>
</div>
<?php
$ui_corner = 'ui-corner-bottom';
}
?>
<?php /* Venue details. Un-comment first and last lines & any venue details you wish to display or use the provided shortcodes. */ ?>
<?php // echo '<div id="venue-details-display">'; ?>
<?php // echo '<p class="section-title">' . __('Venue Details', 'event_espresso') . '</p>'; ?>
<?php // echo $venue_title != ''?'<p id="event_venue_name-'.$event_id.'" class="event_venue_name">'.stripslashes_deep($venue_title).'</p>':''?>
<?php // echo $venue_address != ''?'<p id="event_venue_address-'.$event_id.'" class="event_venue_address">'.stripslashes_deep($venue_address).'</p>':''?>
<?php // echo $venue_address2 != ''?'<p id="event_venue_address2-'.$event_id.'" class="event_venue_address2">'.stripslashes_deep($venue_address2).'</p>':''?>
<?php // echo $venue_city != ''?'<p id="event_venue_city-'.$event_id.'" class="event_venue_city">'.stripslashes_deep($venue_city).'</p>':''?>
<?php // echo $venue_state != ''?'<p id="event_venue_state-'.$event_id.'" class="event_venue_state">'.stripslashes_deep($venue_state).'</p>':''?>
<?php // echo $venue_zip != ''?'<p id="event_venue_zip-'.$event_id.'" class="event_venue_zip">'.stripslashes_deep($venue_zip).'</p>':''?>
<?php // echo $venue_country != ''?'<p id="event_venue_country-'.$event_id.'" class="event_venue_country">'.stripslashes_deep($venue_country).'</p>':''?>
<?php // echo '</div>'; ?>
<?php /* end venue details block */ ?>
<?php if ($display_desc == "Y") { //Show the description or not ?>
<article class="event_description clearfix">
<?php echo espresso_format_content($event_desc); //Code to show the actual description. The Wordpress function "wpautop" adds formatting to your description. ?>
</article>
<?php
}//End display description
?>
</section>
<aside id="sidebar" class="medium-4 columns">
<?php
switch ($is_active['status']) {
case 'EXPIRED':
//only show the event description.
echo '<h3 class="expired_event">' . __('This event has passed.', 'event_espresso') . '</h3>';
break;
case 'REGISTRATION_CLOSED':
//only show the event description.
// if todays date is after $reg_end_date
?>
<div class="event-registration-closed event-messages ui-corner-all ui-state-highlight">
<span class="ui-icon ui-icon-alert"></span>
<p class="event_full">
<strong>
<?php _e('We are sorry, but online sales for this event have ended.', 'event_espresso'); ?>
</strong>
</p>
</div>
<?php
break;
case 'REGISTRATION_NOT_OPEN':
//only show the event description.
// if todays date is after $reg_end_date
// if todays date is prior to $reg_start_date
?>
<div class="event-registration-pending event-messages ui-corner-all ui-state-highlight">
<span class="ui-icon ui-icon-alert"></span>
<p class="event_full">
<strong>
<?php _e('We are sorry but this event is not yet open for registration.', 'event_espresso'); ?>
</strong>
</p>
<p class="event_full">
<strong>
<?php echo __('You will be able to register starting ', 'event_espresso') . ' ' . event_espresso_no_format_date($reg_start_date, 'F d, Y'); ?>
</strong>
</p>
</div>
<?php
break;
default: //This will display the registration form
do_action('action_hook_espresso_registration_page_top', $event_id, $event_meta, $all_meta);
?>
<div class="event_espresso_form_wrapper">
<?php if ($display_reg_form == 'Y') { ?>
<div class="panel">
<h3 class="section-heading"><?php _e('Get Tickets', 'event_espresso'); ?></h3>
<?php if ( !is_user_logged_in() ) { ?>
<div class="memberprompt">
<p>Are you a member?</p>
<p><a href="member-login">Log in</a> to receive your discount!</p>
</div>
<?php } else { ?>
<p>Prices below reflect your member discount. Thank you for your support!</p>
<?php } ?>
<?php } //REG form test ?>
<form method="post" action="<?php echo get_permalink( $event_page_id );?>" id="registration_form">
<?php
//This hides the date/times and location when usign custom post types or the ESPRESSO_REG_FORM shortcode
if ( $reg_form_only == false ){
//do_action('action_hook_espresso_social_display_buttons', $event_id);
if ($display_reg_form == 'Y') {
// Added for seating chart addon
$display_price_dropdown = TRUE;
if (defined('ESPRESSO_SEATING_CHART')) {
$seating_chart_id = seating_chart::check_event_has_seating_chart($event_id);
if ($seating_chart_id !== FALSE) {
$display_price_dropdown = FALSE;
}
}
if ($display_price_dropdown == TRUE) {
$price_label = '<span class="section-title">'.__('Choose an Option: ', 'event_espresso').'</span>';
?>
<p class="event_prices">
<?php do_action( 'espresso_price_select', $event_id, array('show_label'=>TRUE, 'label'=>$price_label) );?>
</p>
<p class="ticketdirs"><a href="<?php bloginfo('url'); ?>/surcharge">Learn how our ticket surcharge supports One Longfellow Square</a></p>
<?php
} else {
?>
<p class="event_prices">
<?php //do_action( 'espresso_seating_price_select_action', $event_id );?>
</p>
<?php
// Seating chart selector
//do_action('espresso_seating_chart_select', $event_id);
}
}
}
// * * This section shows the registration form if it is an active event * *
if ($display_reg_form == 'Y') {
do_action('action_hook_espresso_registration_form_top', $event_id, $event_meta, $all_meta);
?>
<div id="event-reg-form-groups">
<?php
//Outputs the custom form questions. This function can be overridden using the custom files addon
echo event_espresso_add_question_groups( $question_groups, '', NULL, FALSE, array( 'attendee_number' => 1 ), 'ee-reg-page-questions' );
?>
</div>
<?php
//Coupons
?>
<input type="hidden" name="use_coupon[<?php echo $event_id; ?>]" value="<?php echo $use_coupon_code; ?>" />
<?php
if ( in_array( $use_coupon_code, array('Y','G','A')) && function_exists( 'event_espresso_coupon_registration_page' )) {
echo event_espresso_coupon_registration_page($use_coupon_code, $event_id);
}
//End coupons display
//Groupons
?>
<input type="hidden" name="use_groupon[<?php echo $event_id; ?>]" value="<?php echo $use_groupon_code; ?>" />
<?php
if ( $use_groupon_code == 'Y' && function_exists( 'event_espresso_groupon_registration_page' )) {
echo event_espresso_groupon_registration_page($use_groupon_code, $event_id);
}
//End groupons display
?>
<input type="hidden" name="regevent_action" id="regevent_action-<?php echo $event_id; ?>" value="post_attendee">
<input type="hidden" name="event_id" id="event_id-<?php echo $event_id; ?>" value="<?php echo $event_id; ?>">
<?php
//Multiple Attendees
if ( $allow_multiple == "Y" && $number_available_spaces > 1 ) {
//This returns the additional attendee form fields. Can be overridden in the custom files addon.
echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, __('Number of Tickets', 'event_espresso'), true, $event_meta);
} else {
?>
<input type="hidden" name="num_people" id="num_people-<?php echo $event_id; ?>" value="1">
<?php
}
//End allow multiple
wp_nonce_field('reg_nonce', 'reg_form_nonce');
//Recaptcha portion
if ( $org_options['use_captcha'] == 'Y' && empty($_REQUEST['edit_details']) && ! is_user_logged_in()) {
if ( ! function_exists('recaptcha_get_html')) {
require_once(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/recaptchalib.php');
}
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
?>
<p class="event_form_field" id="captcha-<?php echo $event_id; ?>">
<?php _e('Anti-Spam Measure: Please enter the following phrase', 'event_espresso'); ?>
<?php echo recaptcha_get_html($org_options['recaptcha_publickey'], $error, is_ssl() ? true : false); ?>
</p>
<?php
}
//End use captcha
?>
<p class="event_form_submit" id="event_form_submit-<?php echo $event_id; ?>">
<input class="primary radius button btn_event_form_submit" id="event_form_field-<?php echo $event_id; ?>" type="submit" name="Submit" value="<?php _e('Place Order', 'event_espresso'); ?>">
</p>
<p>To redeem a gift certificate, or for further assistance, please call the box office at (207) 761-1757.</p>
<?php
do_action('action_hook_espresso_registration_form_bottom', $event_id, $event_meta, $all_meta);
}
?>
</form>
<?php if ($display_reg_form == 'Y') { ?>
</div><!--Panel-->
<?php } ?>
</div>
<?php
do_action('action_hook_espresso_registration_page_bottom', $event_id, $event_meta, $all_meta);
break;
}
//End Switch statement to check the status of the event
if (isset($ee_style['event_espresso_form_wrapper_close'])) {
echo $ee_style['event_espresso_form_wrapper_close'];
}
?>
<div class='row'>
<div class='showlist small-12 columns'>
<h4>Upcoming Concerts</h4>
<?php echo do_shortcode('[EVENT_CUSTOM_VIEW template_name="small-list-template" limit="10"]'); ?>
<a href="events" class="jump">See All Events &raquo;</a>
</div>
</div>
</aside>
</div>
</div>
</div>
<!--small list template-->
<?php add_action('action_hook_espresso_custom_template_small-list-template','espresso_custom_template_small_list_template');
function espresso_custom_template_small_list_template(){
global $this_event_id, $events, $wpdb;
?>
<ul class='no-bullet'>
<?php if ( $events ) {
foreach ($events as $event) {
$event_id = $event->id;
$event_name = stripslashes_deep($event->event_name);
$event_desc = stripslashes_deep($event->event_desc);
$event_identifier = $event->event_identifier;
$active = $event->is_active;
$registration_start = $event->registration_start;
$registration_end = $event->registration_end;
$start_date = $event->start_date;
$end_date = $event->end_date;
$overflow_event_id = $event->overflow_event_id;
$event_desc = array_shift(explode('<!--more-->', $event_desc));
global $event_meta;
$event_meta = unserialize($event->event_meta);
$event_meta['is_active'] = $event->is_active;
$event_meta['event_status'] = $event->event_status;
$event_meta['start_time'] = empty($event->start_time) ? '' : $event->start_time;
$event_meta['start_date'] = $event->start_date;
$event_meta['registration_start'] = $event->registration_start;
$event_meta['registration_startT'] = $event->registration_startT;
$event_meta['registration_end'] = $event->registration_end;
$event_meta['registration_endT'] = $event->registration_endT;
//ASR
$disp_month = event_espresso_no_format_date($start_date, 'F');
$disp_day = event_espresso_no_format_date($start_date, 'd');
$disp_time = event_espresso_no_format_date($event->start_time, 'g:i A');
$reg_url = espresso_reg_url($event->id);
$disp_date = strtotime($start_date);
?>
<li>
<a href='<?php echo $reg_url; ?>'>
<div class='row'>
<div class='small-4 columns'>
<img src="<?php echo $event_meta['event_thumbnail_url']; ?>">
</div>
<div class='small-8 columns'>
<time><?php echo date('F j', $disp_date); ?></time>
<div class='title'>
<?php echo $event_name; ?>
</div>
</div>
</div>
</a>
</li>
<?php } } ?>
</ul>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment