function UserRegistrationResource::sendEmailNotifications

Same name in other branches
  1. 8.9.x core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php \Drupal\user\Plugin\rest\resource\UserRegistrationResource::sendEmailNotifications()
  2. 10 core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php \Drupal\user\Plugin\rest\resource\UserRegistrationResource::sendEmailNotifications()
  3. 11.x 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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.