Support » Plugin: Five Star Restaurant Reservations - WordPress Booking Plugin » Hook when new booking created

  • Resolved igornn

    (@igornn)


    Hi,
    i want to send sms to site admin when new booking created.
    so what i need is hook after submit and all the data from all fields.

    the hook i need to use is: (am i right?)

    add_action( ‘rtb_insert_booking’, ‘my func’ );

    now the question is how to get all data from the fields? i want to add this data to sms (date,time,name etc…)

    another question:
    what hook i can use to send sms when booking approved or not?

    Thanks

    https://wordpress.org/plugins/restaurant-reservations/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi igornn,

    When you hook into the rtb_insert_booking action, a $booking object will get passed to the function, like this:

    add_action( 'rtb_insert_booking', 'my_function' );
    function my_function( $booking ) {
    
      // This booking has all the details you need, like
      echo $booking->ID;
    
      // You can print_r to view everything it has to offer
      print_r( $booking );
    }

    Keep in mind that rtb_insert_booking is only fired when the booking is initially created. If the booking details or status is updated, rtb_update_booking is fired. Neither is fired when a user just updates the booking status from the Bulk Actions menu in the bookings list.

    If you want to handle multiple events, I strongly suggest you dive into the notifications system within the plugin. Take a look at Notification.Email.class.php for an example of how to extend the rtbNotification class for your needs.

    You’ll then need to hook into rtb_notification_transition_callbacks to register events on which you want to trigger notifications, as well as rtb_notifications to actually register the notification handler in the system.

    Thanks for the help!

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