Events Manager
[resolved] hook for before and after booking cancel (6 posts)

  1. funmusic
    Posted 3 years ago #

    Please, can you add a hook before and after cancelling a booking? When a user makes a booking I take one credit from him so I need to give it back after cancelling. I also need before, because I want to only allow cancelling the event x hours before it happens (for this I am generating a wp nonce only if the condition is met, but the user could generate it earlier and click de link later.


  2. caimin_nwl
    NetWebLogic Support
    Posted 3 years ago #

    How are you hooking into the bookings now?

  3. funmusic
    Posted 3 years ago #

    I believe I am using em_booking_save_pre and em_booking_save. I did this a while back and I didn't remember that the hook was on save, not on creation. Now looking at the comments on the save function, maybe this is also what I need for the cancel, because upon cancelling a booking, the booking object would also have to be written to the database.

  4. agelonwl
    Posted 3 years ago #

    have you tried to hook into em_booking_set_status filter? this is located at classes/em-booking.php e.g. set the status to 3 = Cancelled

  5. funmusic
    Posted 3 years ago #

    I think that could help to disallow the cancellation. For the information I need to update I'll see if em_booking_save works, I want to make sure the data is on the database before putting my data to it. Thanks to both.

  6. funmusic
    Posted 3 years ago #

    I have taken a look at how the hooks mentioned work. Even if the function save says it gets executed even if the booking exists, it looks that em_booking_save (the hook that is inside function save()) doesn't get executed on booking update.

    But em_booking_set_status gets executed, and it does after saving to the database, so it is exactly what I needed. For the pre hook, I still don't know what can I use, but I think for now the wpnonce is enough security. I'll mark this as resolved but everyone is welcome to make further clarifications.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic