/** * Sanitizes the data for the delete ticket ajax call, * and calls the child delete_ticket function. */ public final function ajax_handler_ticket_delete() { if (!isset($_POST["post_ID"])) { $this->ajax_error('Bad post'); } if (!isset($_POST["ticket_id"])) { $this->ajax_error('Bad post'); } if (empty($_POST["nonce"]) || !wp_verify_nonce($_POST["nonce"], 'remove_ticket_nonce') || !current_user_can('edit_tribe_events')) { $this->ajax_error("Cheatin' huh?"); } $post_id = $_POST["post_ID"]; $ticket_id = $_POST["ticket_id"]; // Pass the control to the child object $return = $this->delete_ticket($post_id, $ticket_id); // Successfully deleted? if ($return) { // Let's create a tickets list markup to return $tickets = $this->get_event_tickets($post_id); $return = Tribe__Events__Tickets__Tickets_Pro::instance()->get_ticket_list_markup($tickets); $return = $this->notice(__('Your ticket has been deleted.', 'the-events-calendar')) . $return; // Additionally ensure the event costs meta data is updated accordingly Tribe__Events__API::update_event_cost($post_id); } $this->ajax_ok($return); }