You are here

function _opigno_moxtra_disable_user in Opigno Moxtra 3.x

Same name and namespace in other branches
  1. 8 opigno_moxtra.module \_opigno_moxtra_disable_user()

Disables 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()

1 call to _opigno_moxtra_disable_user()
opigno_moxtra_user_presave in ./opigno_moxtra.module
Implements hook_ENTITY_TYPE_presave().

File

./opigno_moxtra.module, line 179
Contains opigno_moxtra.module.

Code

function _opigno_moxtra_disable_user(UserInterface $user, $save = TRUE) {
  $user
    ->removeRole(OPIGNO_MOXTRA_COLLABORATIVE_FEATURES_RID);

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