function user_permissions_user_cancel in User Permissions 8
Implements hook_user_delete().
File
- ./
user_permissions.module, line 37 - Module file for user_permissions.
Code
function user_permissions_user_cancel($edit, $account, $method) {
// Set user specific role name.
$role_name = '_user_role_' . $account->uid;
// Check for the existence of this role.
$role = Drupal::entityQuery('user_role')
->condition('name', $role_name)
->execute();
if ($role) {
Role::load($role)
->delete();
}
}