You are here

public function GroupInterface::addMember in Group 8

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

Adds a user as a member of the group.

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

Parameters

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

array $values: (optional) Extra values to add to the group membership, like the 'group_roles' field. You cannot overwrite the group ID (gid) or user ID (entity_id) with this method. Leave blank to make the user just a member.

1 method overrides GroupInterface::addMember()
Group::addMember in src/Entity/Group.php
Adds a user as a member of the group.

File

src/Entity/GroupInterface.php, line 107

Class

GroupInterface
Provides an interface defining a Group entity.

Namespace

Drupal\group\Entity

Code

public function addMember(UserInterface $account, $values = []);