is it possible know if the receiver read the message?
-
WP version: 4.2.2
BP version:242
Hellow everyone. is it possible for the sender of the message to know that the receiver read the message already?
-
or maybe there’s a chat plugin that offers this kind of features? just like in facebook. the senders know if the receiver Seen the message.,
I don’t think there’s a message meta table so you’d need to save some data to user meta when
bp_after_message_thread_content
fires.Alternatively there may be a plugin available but I’m not aware of one.
There is a message meta table.
You can find those functions here:
https://buddypress.trac.wordpress.org/browser/tags/2.4.0/src/bp-messages/bp-messages-functions.php#L406I would probably piggyback on the marked as read functionality to do this though.
thanks @Henry Wright 🙂 but what should i do with the code you’ve d given?
hellow @r-a-y its you again. 🙂 what shoul i do with the message meta table you’ve given? sorry im not good with codes. but i’ll try.
Thanks @r-a-y, I think I was looking at an out-of-date database. 🙂
hi @henrywright what whould i do with the message meta table?
Hi @bruce30
You would use
bp_messages_update_meta()
andbp_messages_get_meta()
to add data to and retrieve data from the table. One approach could be to add the user’s ID once the message is viewed and display some kind of indicator on the page to the rest of the message participants.thanks @henrywright 🙂 i will add this code inside the meta? or i will replace some code with this?
sorry @henrywright im not good in coding.. but where should i put the code inside the meta.,?
Hi @bruce30
The code I posted isn’t for cutting and pasting. It’s the name of the functions you could use to complete the task. And the text that follows is an overview of the things you’ll need to do when using those functions.
O man. im not good at this. 🙁 is there any other way? but thanks for your suggestion @henrywright. i hope someone will develop a plugin that notifies a sender that the receiver already seen the message the sender sent.
Hi Henry and r-a-y, I have the same request and I have to thank you for the replies.
Specifically I would add a notification when a user read a received message, so i guess whene a message (or thread?) is marked as read.
If I have to use these functions and hook as well, I understand how to use them, the only thing that I don’t know is how to get IDs. For example when I perform
bp_after_message_thread_content
, in the function that I call, how can I get the id of the thread? Adter I gues I have to get the id of the last message of that thread for change its meta, how can I get that id?Please give me some suggestions and let me know if there are better ways for this.
Sorry for my poor english.bp_get_the_thread_id()
is what you will need.Hi Henry,
Thanks a lot. After that I get the id of the thread, how I can get the id of the last message in the thread?There is an hook called when e message is marked as read? It would be great for me.
Thank you in advantage.
Try this:
$thread = new BP_Messages_Thread( bp_get_the_thread_id() ); echo $thread->last_message_id;
I think it will work for atonio., i have different case. i disabled my read and unread. due to some purposes.
Maybe it could helps someone:
I solved with:
$thread = new BP_Messages_Thread( bp_get_the_thread_id() ); end($thread->messages)->id
last_id_message was null 🙂
helow @anth0ny167 ., good for you., 🙂 can i ask where did put those codes.,??
Bruce you can use this code in your functions.php
function get_id_of_last_message_current_thread() { $thread = new BP_Messages_Thread( bp_get_the_thread_id() ); end($thread->messages)->id; } add_action('bp_after_message_thread_content', 'get_id_of_last_message_current_thread');
thanks @anth0ny167 ., 🙂 i’ll definitely try this. this is what im trying to find. its a big help antonio,. anyway how would i check if it works?
how this works @anth0ny167 ? please help
- The topic ‘is it possible know if the receiver read the message?’ is closed to new replies.