You are here

function sms_user_send_confirmation in SMS Framework 7

Same name and namespace in other branches
  1. 5 modules/sms_user/sms_user.module \sms_user_send_confirmation()
  2. 6.2 modules/sms_user/sms_user.module \sms_user_send_confirmation()
  3. 6 modules/sms_user/sms_user.module \sms_user_send_confirmation()

Sends confirmation code to user for number verification.

Parameters

object $account: The user account object.

string $number: The number to which to send the confirmation code.

array $options: An array of options.

See also

sms_user_settings_add_form_submit()

2 calls to sms_user_send_confirmation()
sms_user_settings_add_form_submit in modules/sms_user/sms_user.module
Submits the user number confirmation request form.
sms_user_user_login in modules/sms_user/sms_user.module
Implements hook_user_login().

File

modules/sms_user/sms_user.module, line 604
Provides integration between the SMS Framework and Drupal users.

Code

function sms_user_send_confirmation($account, $number, $options) {
  $code = rand(1000, 9999);
  $number = sms_formatter($number);
  $data = array(
    'number' => $number,
    'status' => SMS_USER_PENDING,
    'code' => $code,
    'gateway' => $options,
  );
  user_save($account, array(
    'sms_user' => $data,
  ), 'mobile');
  sms_send($number, _sms_user_confirm_message($code), $options);
}