You are here

function role_watchdog_user_insert in Role Watchdog 8

Same name and namespace in other branches
  1. 7.2 role_watchdog.module \role_watchdog_user_insert()

Implements hook_ENTITY_TYPE_insert().

File

./role_watchdog.module, line 58
Contains role_watchdog.module.

Code

function role_watchdog_user_insert(EntityInterface $account) {
  $uid = \Drupal::currentUser()
    ->id();
  role_watchdog_save_entity('Roles added', $uid, RoleWatchdog::ROLE_ADDED, $account
    ->id(), $account
    ->getRoles());
  if (\Drupal::config('role_watchdog.settings')
    ->get('role_watchdog_notify_email') != '') {
    role_watchdog_notify('Roles Added', $account
      ->getRoles(), $account
      ->id());
  }
}