public function SocialPrivateMessageService::getLastMessageFromOtherUser in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 8.2 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 8.3 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 8.4 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 8.5 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 8.6 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 8.7 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 8.8 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 10.3.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 10.0.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 10.1.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
- 10.2.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getLastMessageFromOtherUser()
Last time a message was added to the thread by another user than current.
Parameters
int $uid: The user id.
int $theadid: The thread id.
Return value
int The timestamp.
1 call to SocialPrivateMessageService::getLastMessageFromOtherUser()
- SocialPrivateMessageService::updateUnreadCount in modules/
social_features/ social_private_message/ src/ Service/ SocialPrivateMessageService.php - Update the unread thread count.
File
- modules/
social_features/ social_private_message/ src/ Service/ SocialPrivateMessageService.php, line 136
Class
- SocialPrivateMessageService
- Class SocialPrivateMessageService.
Namespace
Drupal\social_private_message\ServiceCode
public function getLastMessageFromOtherUser($uid, $theadid) {
$query = "SELECT MAX(`pm`.`created`) FROM `private_message_thread__private_messages` `pmt` JOIN `private_messages` `pm` ON `pm`.`id` = `pmt`.`private_messages_target_id` WHERE `pmt`.`entity_id` = :pmt AND `pm`.`owner` <> :uid";
$vars = [
':uid' => $uid,
':pmt' => $theadid,
];
$timestamp = $this->database
->query($query, $vars)
->fetchCol();
// Chop of the head.
if (is_array($timestamp)) {
$timestamp = $timestamp[0];
}
return $timestamp;
}