• How to call a custom function from functions.php once a successful booking has been made and/or cancelled.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bachir8k

    (@bachir8k)

    I found a lazy way to approach this issue, by adding the below within the email_messages() function in em-booking.php

    if($this->booking_status == 1){
    cf_bookingConfirmed();
    }elseif($this->booking_status == 3){
    cf_bookingCanceled();
    }

    As long as this email_messages() function will not be called during any cron_jobs or other processes, it will be fine.

    My ultimate solution would be something like:
    apply_filters(’em_booking_success’, ‘cf_bookingConfirmed’);

    Any thoughts?

    You could use the action em_booking_changed to detect when an event is canceled

    add_action('em_booking_status_changed', 'my_booking_status_changed', 10, 2);
    function my_booking_status_changed($booking, $assocArr) 
        ...
    }

    The argument $booking is an object of type EM_Booking and the $assocArr is an associative array with the keys as follows: ‘status’, ’email’ (value can be true or false), ‘ignore_spaces’ (can be true or false).

    There’s an action ’em_bookings_deleted’ that gets the following arguments: $result, $booking_ids, $event_ids

    There’s an action ’em_bookings_added’ which gets a single argument: $EM_Booking.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add_action’ is closed to new replies.