You are here

function twilio_user_send_confirmation in Twilio 7

Send confirmation message.

@todo Please document this function.

Parameters

object $account: The user object of the account to message

string $number: The phone number to send the message

string $country: The country code for the number

See also

http://drupal.org/node/1354

2 calls to twilio_user_send_confirmation()
twilio_register_submit in ./twilio.user.inc
Custom submit handler for phone numbers during registration.
twilio_user_settings_add_form_submit in ./twilio.pages.inc
Submit handler for user settings form.

File

./twilio.user.inc, line 171
Twilio user account and registration related functionality

Code

function twilio_user_send_confirmation($account, $number, $country) {
  $code = rand(1000, 9999);
  $data = array(
    'uid' => $account->uid,
    'number' => $number,
    'country' => $country,
    'status' => TWILIO_USER_PENDING,
    'code' => $code,
  );
  $account = user_save($account, array(
    'twilio' => $data,
  ), 'twilio');
  $message = "Confirmation code: {$code}";
  twilio_send($number, $message, $country);
  return $account;
}