You are here

function user_email_verification_user_presave in User email verification 8

Same name and namespace in other branches
  1. 7 user_email_verification.module \user_email_verification_user_presave()

Implements hook_ENTITY_TYPE_presave().

File

./user_email_verification.module, line 303
User email verification hooks and alters.

Code

function user_email_verification_user_presave(UserInterface $user) {

  // Mark user Email verified when admin user activates blocked user account.
  if (\Drupal::currentUser()
    ->hasPermission('administer users') && isset($user->original) && $user->original
    ->isBlocked() && $user
    ->isActive()) {
    \Drupal::service('user_email_verification.service')
      ->setEmailVerifiedByUserId($user
      ->id());
  }
}