You are here

public function PrivateMessageService::getFirstThreadForUser in Private Message 8.2

Same name and namespace in other branches
  1. 8 src/Service/PrivateMessageService.php \Drupal\private_message\Service\PrivateMessageService::getFirstThreadForUser()

Get the most recently updated thread for the given user.

Parameters

\Drupal\user\Entity\UserInterface $user: The user whose most recently updated thread should be retrieved.

Overrides PrivateMessageServiceInterface::getFirstThreadForUser

File

src/Service/PrivateMessageService.php, line 134

Class

PrivateMessageService
The Private Message service for the private message module.

Namespace

Drupal\private_message\Service

Code

public function getFirstThreadForUser(UserInterface $user) {
  $thread_id = $this->mapper
    ->getFirstThreadIdForUser($user);
  if ($thread_id) {
    return $this->pmThreadManager
      ->load($thread_id);
  }
  return FALSE;
}