You are here

function twilio_user_save in Twilio 7

Saves mobile number data to the {twilio_user} table in the database.

2 calls to twilio_user_save()
twilio_user_insert in ./twilio.user.inc
Implements hook_user_insert().
twilio_user_update in ./twilio.user.inc
Implements hook_user_update().

File

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

Code

function twilio_user_save(&$edit, $account, $category) {
  if ($category == 'twilio' && isset($edit['twilio'])) {
    $number = (object) $edit['twilio'];
    $number->uid = $account->uid;
    $primary_keys = array();
    if (isset($account->twilio_user['status'])) {
      if ($account->twilio_user['status'] == TWILIO_USER_PENDING && $edit['twilio']['status'] == TWILIO_USER_CONFIRMED) {
        $primary_keys = array(
          'uid',
        );
      }
    }
    drupal_write_record('twilio_user', $number, $primary_keys);
    $edit['twilio']['number'] = NULL;
    $edit['twilio']['status'] = NULL;
    $edit['twilio']['code'] = NULL;
  }
}