You are here

public function Group::removeMember in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Group.php \Drupal\group\Entity\Group::removeMember()

Removes a user as a member from the group.

Does nothing if the user is not a member of the group.

Parameters

\Drupal\user\UserInterface $account: The user entity to remove as a member.

Overrides GroupInterface::removeMember

File

src/Entity/Group.php, line 199

Class

Group
Defines the Group entity.

Namespace

Drupal\group\Entity

Code

public function removeMember(UserInterface $account) {
  if ($member = $this
    ->getMember($account)) {
    $member
      ->getGroupContent()
      ->delete();
  }
}