You are here

function twilio_user_settings_confirm_form_submit in Twilio 7

Submit handler for user settings confirmation form.

@todo Please document this function.

See also

http://drupal.org/node/1354

1 string reference to 'twilio_user_settings_confirm_form_submit'
twilio_user_settings_form in ./twilio.pages.inc
User settings form.

File

./twilio.pages.inc, line 175
User facing pages

Code

function twilio_user_settings_confirm_form_submit($form, &$form_state) {
  $account = user_load($form_state['values']['uid']);
  if ($form_state['clicked_button']['#value'] == t('Delete & start over')) {
    twilio_user_delete($account);
    $account = user_load($form_state['values']['uid'], TRUE);
    drupal_set_message(t('Your mobile information has been removed'), 'status');
  }
  else {
    $data = array(
      'number' => $account->twilio_user['number'],
      'status' => TWILIO_USER_CONFIRMED,
    );
    $account = user_save($account, array(
      'twilio' => $data,
    ), 'twilio');
    drupal_set_message(t('Your mobile number has been confirmed'), 'status');
  }
  $form_state['values']['account'] = $account;
  $form_state['rebuild'] = TRUE;
}