Skip to:
Content
Pages
Categories
Search
Top
Bottom

mark the message as read


  • trapsen
    Participant

    @trapsen

    Hello,
    Is it possible to mark the messages as read on Messenger? like whatsapp?

    I found a snippet of code on the internet and wanted to enter it into bp-custom.php, but it doesn’t work. Does anyone have another solution for this?

    Snippet:

    <?php 
    // check message is reply and read                  
    $thread = new BP_Messages_Thread( bp_get_message_thread_id() );
    $user = wp_get_current_user();
    
    foreach ( $thread->sender_ids as $key => $value ) {
        if ( $value != $user->ID ) {
            $recipient_id = $value;
        }                               
    }
    
    if ( $thread->last_sender_id == $user->ID ) {
    
        if( $thread->recipients[$recipient_id]->unread_count > 0 ){
            echo('<i class="fa fa-reply" aria-hidden="true"></i>');
        }else{
            echo('<i class="fa fa-check" aria-hidden="true"></i>');
        }
    }
    ?>

    best regards

  • You must be logged in to reply to this topic.
Skip to toolbar