Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active December 11, 2015 05:28
Show Gist options
  • Select an option

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

Select an option

Save joshfeck/4552287 to your computer and use it in GitHub Desktop.
Shows unavailable time slots and disables them from being selected.
<?php
switch ( $org_options['time_reg_limit'] ) {//This checks to see if the time slots are controlled by registration limits.
case 'Y':
//If the time slot is controlled by a registration limit.
//Then we need to check if there are enough spaces available.
//if (($time->reg_limit == 0)||($time->reg_limit > 0 && $time->reg_limit >=$num_attendees))
//If enough spaces are available, then show this time slot
if ($time->available_spaces > 0){
$html .= '<option' . $selected . ' value="' . $time->id . '">' . event_date_display($time->start_time, get_option('time_format')) . ' - ' . event_date_display($time->end_time, get_option('time_format')) . " ($time->available_spaces " . __('available spaces', 'event_espresso') . ")" . '</option>';}
else{
$html .= '<option' . $selected . ' value="' . $time->id . '" disabled="disabled">' . event_date_display($time->start_time, get_option('time_format')) . ' - ' . event_date_display($time->end_time, get_option('time_format')) . " ($time->available_spaces " . __('available spaces', 'event_espresso') . ")" . ' Sold Out</option>';
}
break;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment