Support » Plugin: Events Manager » hook for before and after booking cancel

  • Resolved funmusic


    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support caimin_nwl


    NetWebLogic Support

    How are you hooking into the bookings now?

    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.

    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

    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.

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘hook for before and after booking cancel’ is closed to new replies.