Skip to:
Content
Pages
Categories
Search
Top
Bottom

is it possible know if the receiver read the message?


  • bruce30
    Participant

    @bruce30

    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?

Viewing 22 replies - 1 through 22 (of 22 total)

  • bruce30
    Participant

    @bruce30

    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.,


    Henry Wright
    Moderator

    @henrywright

    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.


    r-a-y
    Keymaster

    @r-a-y

    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#L406

    I would probably piggyback on the marked as read functionality to do this though.


    bruce30
    Participant

    @bruce30

    thanks @Henry Wright 🙂 but what should i do with the code you’ve d given?


    bruce30
    Participant

    @bruce30

    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.


    Henry Wright
    Moderator

    @henrywright

    Thanks @r-a-y, I think I was looking at an out-of-date database. 🙂


    bruce30
    Participant

    @bruce30

    hi @henrywright what whould i do with the message meta table?


    Henry Wright
    Moderator

    @henrywright

    Hi @bruce30

    You would use bp_messages_update_meta() and bp_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.


    bruce30
    Participant

    @bruce30

    thanks @henrywright 🙂 i will add this code inside the meta? or i will replace some code with this?


    bruce30
    Participant

    @bruce30

    sorry @henrywright im not good in coding.. but where should i put the code inside the meta.,?


    Henry Wright
    Moderator

    @henrywright

    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.


    bruce30
    Participant

    @bruce30

    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.


    Antonio
    Participant

    @anth0ny167

    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.


    Henry Wright
    Moderator

    @henrywright

    bp_get_the_thread_id() is what you will need.


    Antonio
    Participant

    @anth0ny167

    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.


    Henry Wright
    Moderator

    @henrywright

    Try this:

    $thread = new BP_Messages_Thread( bp_get_the_thread_id() );
    echo $thread->last_message_id;

    bruce30
    Participant

    @bruce30

    I think it will work for atonio., i have different case. i disabled my read and unread. due to some purposes.


    Antonio
    Participant

    @anth0ny167

    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 🙂


    bruce30
    Participant

    @bruce30

    helow @anth0ny167 ., good for you., 🙂 can i ask where did put those codes.,??


    Antonio
    Participant

    @anth0ny167

    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');

    bruce30
    Participant

    @bruce30

    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?


    bruce30
    Participant

    @bruce30

    how this works @anth0ny167 ? please help

Viewing 22 replies - 1 through 22 (of 22 total)
  • The topic ‘is it possible know if the receiver read the message?’ is closed to new replies.
Skip to toolbar