You are here

function _opigno_moxtra_enable_user in Opigno Moxtra 3.x

Same name and namespace in other branches
  1. 8 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 159
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();
  }
}