I have created an admin page where an organizer can add users to an event.
I can create booking using your functions eo_insert_booking and eo_confirm_booking.
However, checking the database the table wp_eo_booking_tickets is never updated and it seems like the booking of the ticket is somehow not complete. What other function needs to run to complete the booking of a spot?
Below my function to create this booking.
Thanks!
function acc_add_booking($acc_event_id,$acc_member_login){<br>
$acc_member_id=get_user_by( 'login', $acc_member_login )->ID; <br>
$acc_occurence_id=get_closest_occurrence_id($acc_event_id); <br>
$event_ticket=eo_get_event_tickets( $acc_event_id, $acc_occurence_id );
$booking = array(
'booking_user' => $acc_member_id,
'booking_status' => 'confirmed',
'event_id' => $acc_event_id,
'occurrence_id' => $acc_occurence_id,
'ticketinstances'=> array(
$event_ticket->mid => array( //1 ticket of type ID 13
array( 'eocid' => 'eoc1', 'type' => $event_ticket->mid ),
),
),
);<br>
$booking_id = eo_insert_booking( $booking );
if($booking_id!=0){
eo_confirm_booking( $booking_id );
accwebmaster
Hi there,
I hope the code makes sense, please let me know if I can clean it up somehow.
Any idea what I am missing?
Thanks,
Florian
accwebmaster
Figured it out,
$event_ticket->mid was not returning the correct ticket id…
accwebmaster
Hi Florian,
Maybe there is some missing code, but eo_get_event_tickets()
returns an array of tickets. (EO_Event_Ticket_Type
); You can access the ID via $ticket->type_id()
(though I think $ticket['mid']
might also work).
Stephen Harris