Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active December 19, 2015 20:08
Show Gist options
  • Select an option

  • Save joshfeck/6010886 to your computer and use it in GitHub Desktop.

Select an option

Save joshfeck/6010886 to your computer and use it in GitHub Desktop.
This is a modified section of Event Espresso's registration_page_display.php template that adds a check to see if the user is logged in. If they are logged out, it will display a single price instead of a dropdown of price options. This is useful in situations where multiple price options are offered to Members (via the WP user integration add-o…
<?php
// 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;
}
}
// start customization
// check to see if the user is logged in
if ( ! is_user_logged_in()) {
// they are not logged in, so we're only going to display one price
echo '<p class="event_prices">';
// display the first price entered for non-members
echo '<span class="event_price_label">Price:</span><span class="event_price_value">$' . do_shortcode('[EVENT_PRICE event_id="'.$event_id.'" number="0"]') . '</span>';
echo '</p>';
echo '<style>.event_prices label,.event_prices select {display: none;}</style>';
}
// end customization
// they are logged in, so we'll display the price select box
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>
<?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);
}
?>
<div id="event-reg-form-groups">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment