public function UserEmailVerification::createVerification in User email verification 8
Create user email verification item.
Parameters
\Drupal\user\UserInterface $user: User to create email verification item for.
bool $verify: Flag mark as verified/no on creation.
Overrides UserEmailVerificationInterface::createVerification
File
- src/
UserEmailVerification.php, line 288
Class
- UserEmailVerification
- User email verification helper service.
Namespace
Drupal\user_email_verificationCode
public function createVerification(UserInterface $user, $verify = FALSE) {
$skip_roles = $this
->getSkipRoles();
$verified = 0;
if ($skip_roles) {
foreach ($skip_roles as $skip_role) {
if ($user
->hasRole($skip_role)) {
$verified = $this->time
->getRequestTime();
break;
}
}
}
if ($verify) {
$verified = $this->time
->getRequestTime();
}
$this->database
->insert(UserEmailVerificationInterface::VERIFICATION_TABLE_NAME)
->fields([
'uid' => $user
->id(),
'verified' => $verified,
'last_reminder' => $this->time
->getRequestTime(),
'reminders' => 0,
])
->execute();
}