public function SocialPrivateMessageService::getAllThreadIdsForUser in Open Social 8.4
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::getAllThreadIdsForUser()
- 8 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 8.2 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 8.3 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 8.5 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 8.6 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 8.7 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 8.8 modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 10.3.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 10.0.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 10.1.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
- 10.2.x modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php \Drupal\social_private_message\Service\SocialPrivateMessageService::getAllThreadIdsForUser()
Copy function of the one in the private_message module to disable count.
1 call to SocialPrivateMessageService::getAllThreadIdsForUser()
- 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 104
Class
- SocialPrivateMessageService
- Class SocialPrivateMessageService.
Namespace
Drupal\social_private_message\ServiceCode
public function getAllThreadIdsForUser($uid) {
$query = 'SELECT DISTINCT(thread.id), MAX(thread.updated) ' . 'FROM {private_message_threads} AS thread ' . 'JOIN {private_message_thread__members} AS member ' . 'ON member.entity_id = thread.id AND member.members_target_id = :uid ' . 'JOIN {private_message_thread__private_messages} AS thread_messages ' . 'ON thread_messages.entity_id = thread.id ' . 'JOIN {private_messages} AS messages ' . 'ON messages.id = thread_messages.private_messages_target_id ' . 'JOIN {private_message_thread__last_delete_time} AS thread_delete_time ' . 'ON thread_delete_time.entity_id = thread.id ' . 'JOIN {pm_thread_delete_time} as owner_delete_time ' . 'ON owner_delete_time.id = thread_delete_time.last_delete_time_target_id AND owner_delete_time.owner = :uid ' . 'WHERE owner_delete_time.delete_time <= messages.created ';
$vars = [
':uid' => $uid,
];
$query .= 'GROUP BY thread.id ORDER BY MAX(thread.updated) DESC, thread.id';
$thread_ids = $this->database
->query($query, $vars)
->fetchCol();
return is_array($thread_ids) ? $thread_ids : [];
}