eo_insert_booking
since 1.0
Pro
eo_insert_booking( $booking )
Inserts a booking for an event.
The $booking array expects:
- booking_user (int) ID of bookee
- event_id (int) Event (post ID)
- occurrence_id (int) Occurrence id - 0 if booking is for entire series
- booking_date (string) Date in 'Y-m-d H:i:s' format. Leave blank for current time.
- booking_notes (string) Any booking notes. Optional.
- booking_status (string). 'confirmed' or 'pending'. Default 'pending'
- tickets (array) Array of form ticket ID => qty
- transaction_id (string) A transaction number (e.g. gateway's ID for this booking). Optional.
Example
$booking = array(
'booking_user' => 1,
'booking_status' => 'pending',
'event_id' => 127,
'occurrence_id' => 234,
'ticketinstances'=> array(
13 => array(
array( 'eocid' => 'eoc1', 'type' => 13 ),
),
16 => array(
array( 'eocid' => 'eoc2', 'type' => 16 ),
array( 'eocid' => 'eoc3', 'type' => 16 ),
array( 'eocid' => 'eoc4', 'type' => 16 ),
),
),
);
$booking_id = eo_insert_booking( $booking );
The client (or temproary ID), eocid, should be unique to the booking.
Parameters
array
|
$booking |
Array containing booking data
|
Return value
int
|
Booking ID or 0 on failure
|
Hooks
Changelog
1.0
|
|
1.11.0
|
Use 'ticketinstances' to create tickets for the booking as demonstrated above, not a 'tickets' argument with an array mapping ticket type to quantity.
|