public function getLastMessageFromOtherUser($uid, $thread_id) {
    $timestamp = $this->database->query(
      'SELECT MAX(pm.created) ' .
      'FROM {private_message_thread__private_messages} pmt ' .
      'JOIN {private_messages} pm ON pmt.private_messages_target_id = pm.id ' .
      'WHERE pmt.entity_id = :thread AND pm.owner <> :uid',
      [
        ':thread' => $thread_id,
        ':uid' => $uid,
      ]
    )->fetchCol();

    // Chop of the head.
    if (is_array($timestamp)) {
      $timestamp = ($timestamp[0] !== NULL) ? $timestamp[0] : 0;
    }

    return $timestamp;
  }
public function getLastMessageFromOtherUser($uid, $thread_id) {
    $timestamp = $this->database->query(
      'SELECT MAX(pm.created) ' .
      'FROM {private_message_thread__private_messages} pmt ' .
      'JOIN {private_messages} pm ON pmt.private_messages_target_id = pm.id ' .
      'WHERE pmt.entity_id = :thread AND pm.owner <> :uid',
      [
        ':thread' => $thread_id,
        ':uid' => $uid,
      ]
    )->fetchCol();

    // Chop of the head.
    if (is_array($timestamp)) {
      $timestamp = ($timestamp[0] !== NULL) ? $timestamp[0] : 0;
    }

    return $timestamp;
  }
public function getLastMessageFromOtherUser ( $ uid , $ thread_id ) { $ timestamp = $ this -> database -> query ( 'SELECT MAX(pm.created) ' . 'FROM {private_message_thread__private_messages} pmt ' . 'JOIN {private_messages} pm ON pmt.private_messages_target_id = pm.id ' . 'WHERE pmt.entity_id = :thread AND pm.owner <> :uid' , [ ':thread' => $ thread_id , ':uid' => $ uid , ] ) -> fetchCol ( ) ; // Chop of the head. if ( is_array ( $ timestamp ) ) { $ timestamp = ( $ timestamp [ 0 ] !== NULL ) ? $ timestamp [ 0 ] : 0 ; } return $ timestamp ; }
Last time a message was added to the thread by another user than current.

@param int $uid
The user id.
@param int $thread_id
The thread id.

@return int
The timestamp or 0 if nothing was found.
Last time a message was added to the thread by another user than current .