You are here

public function PrivateMessageThread::isMember in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Entity/PrivateMessageThread.php \Drupal\private_message\Entity\PrivateMessageThread::isMember()

Check if the user with the given ID is a member of the thread.

Parameters

int $id: The User ID of the user to check.

Return value

bool

  • TRUE if the user is a member of the thread
  • FALSE if they are not

Overrides PrivateMessageThreadInterface::isMember

File

src/Entity/PrivateMessageThread.php, line 72

Class

PrivateMessageThread
Defines the Private Message Thread entity.

Namespace

Drupal\private_message\Entity

Code

public function isMember($id) {
  $members = $this
    ->getMembers();
  foreach ($members as $member) {
    if ($member
      ->id() == $id) {
      return TRUE;
    }
  }
  return FALSE;
}