- This topic has 3 replies, 2 voices, and was last updated 2 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forums › BP Better Messages › Is there a custom event in BM 2.0 after a user leaves a chatroom?
In 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.
How 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.
Good 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
and bp-better-messages-leave
events that would trigger joining or leaving a chatroom. That would be super helpful as well.
Thank you for considering.
Hi 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_leave
If need any other hooks, let me know!