Home › Forums › BP Better Messages › Is there a custom event in BM 2.0 after a user leaves a chatroom?
- This topic has 3 replies, 2 voices, and was last updated 5 months, 4 weeks ago by
Support.
- AuthorPosts
- December 9, 2022 at 4:42 pm #19051
Maarten
ParticipantIn the old plugin I redirected users to a different page after they left a chatroom. I did this through the ‘bp-better-messages-reinit-end’ javascript event. But this doesn’t work anymore in BM 2.0.
Is there an event that is triggered whenever a user joins or leaves a chatroom? That would be super helpful.
Thank you for the great work.
December 9, 2022 at 5:38 pm #19056Support
KeymasterHow did you detect if user joined or leave ? Let me know which exactly hooks you need and I will add using wordpress JS hooks api.
December 10, 2022 at 4:15 pm #19060Maarten
ParticipantGood question, that was a bit of a creative workaround actually. I made a seperate join/leave button, which would then trigger the click events on the existing BM join/leave buttons. Then after the leave button was triggered I would wait for the
bp-better-messages-reinit-end
event and know that the user had just ‘left’ which meant I could trigger a redirect.With BM 2.0 triggering the leave button doesn’t work anymore, since the leave button is only added to the DOM after clicking the 3 dots menu. But if there would be a
bp-better-messages-left
event, I could redirect (or do something else) whenever somebody leaves a chatroom, which would be very useful.If it would be possible to also add a
bp-better-messages-join
andbp-better-messages-leave
events that would trigger joining or leaving a chatroom. That would be super helpful as well.Thank you for considering.
December 10, 2022 at 5:26 pm #19061Support
KeymasterHi there!
Next version:
https://www.better-messages.com/docs/development/js-actions/better_messages_chat_room_join
https://www.better-messages.com/docs/development/js-actions/better_messages_chat_room_leaveIf need any other hooks, let me know!
- AuthorPosts
- You must be logged in to reply to this topic.