You are here

protected function UserRegistrationResource::sendEmailNotifications in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php \Drupal\user\Plugin\rest\resource\UserRegistrationResource::sendEmailNotifications()

Sends email notifications if necessary for user that was registered.

Parameters

\Drupal\user\UserInterface $account: The user account.

1 call to UserRegistrationResource::sendEmailNotifications()
UserRegistrationResource::post in core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php
Responds to user registration POST request.

File

core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php, line 175

Class

UserRegistrationResource
Represents user registration as a resource.

Namespace

Drupal\user\Plugin\rest\resource

Code

protected function sendEmailNotifications(UserInterface $account) {
  $approval_settings = $this->userSettings
    ->get('register');

  // No e-mail verification is required. Activating the user.
  if ($approval_settings == UserInterface::REGISTER_VISITORS) {
    if ($this->userSettings
      ->get('verify_mail')) {

      // No administrator approval required.
      _user_mail_notify('register_no_approval_required', $account);
    }
  }
  elseif ($approval_settings == UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) {
    _user_mail_notify('register_pending_approval', $account);
  }
}