function _opigno_moxtra_disable_user in Opigno Moxtra 8
Same name and namespace in other branches
- 3.x 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
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 177 - 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();
}
}