You are here

public function PrivateMessageService::getCountThreadsForUser in Private Message 8.2

Retrieve the number of threads a user has.

Return value

int The number of threads a user has.

Overrides PrivateMessageServiceInterface::getCountThreadsForUser

File

src/Service/PrivateMessageService.php, line 170

Class

PrivateMessageService
The Private Message service for the private message module.

Namespace

Drupal\private_message\Service

Code

public function getCountThreadsForUser() {
  $user = $this->userManager
    ->load($this->currentUser
    ->id());
  $thread_ids = $this->mapper
    ->getThreadIdsForUser($user);
  return count($thread_ids);
}