Tribe__Events__Community__Tickets__Main::ajax_handler_ticket_save()
Auto-appends the author ID onto the SKU
Source
File: src/Tribe/Main.php
public function ajax_handler_ticket_save() {
if ( ! isset( $_POST['formdata'] ) ) {
return;
}
if ( ! isset( $_POST['post_ID'] ) ) {
return;
}
if ( ! $post = get_post( $_POST['post_ID'] ) ) {
return;
}
$form_data = wp_parse_args( $_POST['formdata'] );
if ( empty( $form_data['ticket_name'] ) ) {
$form_data['ticket_name'] = 'ticket';
}
// make sure the SKU is set to the correct value
$form_data['ticket_woo_sku'] = "{$post->ID}-{$post->post_author}-" . sanitize_title( $form_data['ticket_name'] );
$_POST['formdata'] = http_build_query( $form_data );
}