Booking a guest from the admin panel

WordPress Event Management, Calendars & Registration Forums General Question Booking a guest from the admin panel

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 5 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #35438

    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
    #35455

    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
    #35456

    Figured it out,
    $event_ticket->mid was not returning the correct ticket id…

    accwebmaster
    #35460

    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
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.