You are here

public function UserEmailVerification::remindUserById in User email verification 8

Reminds user about verification user by ID.

Parameters

int $uid: User ID.

Overrides UserEmailVerificationInterface::remindUserById

File

src/UserEmailVerification.php, line 442

Class

UserEmailVerification
User email verification helper service.

Namespace

Drupal\user_email_verification

Code

public function remindUserById($uid) {
  if ($this
    ->isReminderNeeded($uid)) {
    $this
      ->sendVerifyMailById($uid);

    // Always increase the reminder mail counter by one even if sending
    // the mail failed. Some mail systems like Mandrill return FALSE if
    // they cannot deliver the mail to an invalid address. We need to
    // increase counter to make sure that users get blocked at some point.
    $this->database
      ->update(UserEmailVerificationInterface::VERIFICATION_TABLE_NAME)
      ->condition('uid', $uid, '=')
      ->expression('reminders', 'reminders + :amount', [
      ':amount' => 1,
    ])
      ->fields([
      'last_reminder' => $this->time
        ->getRequestTime(),
    ])
      ->execute();
  }
}