public function AccountRegistration::createAccount in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_user/src/AccountRegistration.php \Drupal\sms_user\AccountRegistration::createAccount()
- 2.1.x modules/sms_user/src/AccountRegistration.php \Drupal\sms_user\AccountRegistration::createAccount()
Process an incoming SMS to see if a new account should be created.
Parameters
\Drupal\sms\Message\SmsMessageInterface $sms_message: An incoming SMS message.
Overrides AccountRegistrationInterface::createAccount
File
- modules/
sms_user/ src/ AccountRegistration.php, line 80
Class
- AccountRegistration
- Defines the account registration service.
Namespace
Drupal\sms_userCode
public function createAccount(SmsMessageInterface $sms_message) {
$this->userPhoneNumberSettings = $this->phoneNumberVerificationProvider
->getPhoneNumberSettings('user', 'user');
if (!$this->userPhoneNumberSettings) {
// Can't do anything if there is no phone number settings for user.
return;
}
$sender_number = $sms_message
->getSenderNumber();
if (!empty($sender_number)) {
// Any users with this phone number?
$entities = $this->phoneNumberVerificationProvider
->getPhoneVerificationByPhoneNumber($sender_number, NULL, 'user');
if (!count($entities)) {
if (!empty($this
->settings('unrecognized_sender.status'))) {
$this
->allUnknownNumbers($sms_message);
}
if (!empty($this
->settings('incoming_pattern.status'))) {
$this
->incomingPatternMessage($sms_message);
}
}
}
}