get_bookings()->add_from_post(); if($result){ $return = array('result'=>true, 'message'=>$EM_Event->get_bookings()->feedback_message); }else{ $return = array('result'=>false, 'message'=>implode('
', $EM_Event->get_bookings()->errors)); } echo EM_Object::json_encode($return); exit(); }else{ $return = array('result'=>false, 'message'=>''); echo EM_Object::json_encode($return); exit(); } } /** * Check if there's any actions to take for bookings * @return null */ function actions() { global $wpdb; global $EM_Event, $EM_Person; if( @get_class($EM_Event) == 'EM_Event' ){ //ADD/EDIT Booking if (isset($_POST['action']) && $_POST['action'] == 'add_booking') { check_admin_referer( 'em_add_booking', '_wpnonce_em_add_booking' ); $EM_Event->get_bookings()->add_from_post(); } //CANCEL Booking if (isset($_POST['action']) && $_POST['action'] == 'cancel_booking') { self::cancel_booking(); } } } /** * Handles booking cancellations on the front end. makes a few extra checks. */ function cancel_booking(){ global $EM_Event; if( is_user_logged_in() ){ $canceled = 0; foreach($EM_Event->get_bookings()->bookings as $EM_Booking){ if($EM_Booking->person->ID == $EM_Person->ID ){ $EM_Booking->cancel(); $canceled++; } } if($canceled > 0){ self::$em_form_messages_booking_cancel['success'] = __('Booking cancelled', 'dbem'); } }else{ self::$em_form_messages_booking_cancel['error'] = __('You must log in to cancel your booking.', 'dbem'); } } /** * Returns the booking form for the front-end, displayed when using placeholder #_ADDBOOKINGFORM * @return string */ function create() { global $em_form_messages_booking_add, $EM_Event; $booked_places_options = array(); for ( $i = 1; $i <= 10; $i++ ) { $booking_spaces = (!empty($_POST['booking_spaces']) && $_POST['booking_spaces'] == $i) ? 'selected="selected"':''; array_push($booked_places_options, ""); } ob_start(); ?>

get_bookings()->feedback_message) && count($EM_Event->get_bookings()->errors) == 0 ) : ?>
get_bookings()->feedback_message; ?>
get_bookings()->errors) > 1 ) : ?>
', $EM_Event->get_bookings()->errors); ?>
get_bookings()->feedback_message) ) : ?>
get_bookings()->feedback_message; ?>
get_bookings()->get_tickets():$EM_Event->get_bookings()->get_tickets(); if( (count($EM_Tickets->tickets) > 1 || !empty($EM_Tickets->get_first()->price)) && (get_option('dbem_bookings_tickets_show_loggedout') || is_user_logged_in()) ): ?> tickets as $EM_Ticket ): ?> is_available() || get_option('dbem_bookings_tickets_show_unavailable') ): ?>
output_property('name'); ?> output_property('price'); ?> get_spaces_options(); if( $spaces_options ){ echo $spaces_options; }else{ echo "".__('N/A','dbem').""; } ?>
tickets) > 0 ) : ?> get_first(); ?> tickets) == 1 && empty($EM_Tickets->get_first()->price)) ): ?>
: get_spaces_options(false); if( $spaces_options ){ echo $spaces_options; }else{ echo "".__('N/A','dbem').""; } ?>
:
'); ?>
tickets) == 0 ): ?>
register or log in in order to create and manage your bookings.','dbem'), site_url('wp-login.php?action=register', 'login_post'), site_url('wp-login.php', 'login_post')); ?>

'/>

Please log in to manage your bookings.