function UserInterface::addRole

Same name in other branches
  1. 9 core/modules/user/src/UserInterface.php \Drupal\user\UserInterface::addRole()
  2. 8.9.x core/modules/user/src/UserInterface.php \Drupal\user\UserInterface::addRole()
  3. 11.x core/modules/user/src/UserInterface.php \Drupal\user\UserInterface::addRole()

Add a role to a user.

Parameters

string $rid: The role ID to add.

Return value

$this

1 method overrides UserInterface::addRole()
User::addRole in core/modules/user/src/Entity/User.php
Add a role to a user.

File

core/modules/user/src/UserInterface.php, line 75

Class

UserInterface
Provides an interface defining a user entity.

Namespace

Drupal\user

Code

public function addRole($rid);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.