You are here

function _opigno_moxtra_enable_user in Opigno Moxtra 8

Same name and namespace in other branches
  1. 3.x opigno_moxtra.module \_opigno_moxtra_enable_user()

Enables user in the Moxtra.

Parameters

\Drupal\user\UserInterface $user: User.

bool $save: False to not save user immediately.

Throws

\Drupal\Core\Entity\EntityStorageException

See also

opigno_moxtra_user_update()

File

./opigno_moxtra.module, line 157
Contains opigno_moxtra.module.

Code

function _opigno_moxtra_enable_user(UserInterface $user, $save = TRUE) {
  $user
    ->addRole(OPIGNO_MOXTRA_COLLABORATIVE_FEATURES_RID);

  // API will be notified in hook_ENTITY_TYPE_update().
  if ($save) {
    $user
      ->save();
  }
}