You are here

function fbconnect_user_settings_form_submit in Facebook Connect 6

Same name and namespace in other branches
  1. 5 fbconnect.module \fbconnect_user_settings_form_submit()
  2. 6.2 fbconnect.pages.inc \fbconnect_user_settings_form_submit()

Handle post-validation user_settingsForm submission.

File

./fbconnect.pages.inc, line 236

Code

function fbconnect_user_settings_form_submit($form, &$form_state) {
  $account = $form_state['values']['account'];
  $visible = $form_state['values']['visibility'];
  $avatar = $form_state['values']['fb_avatar'];
  $op = $form_state['values']['op'];
  $fbuid = $account->fbuid;
  $data['fb_visible'] = $form_state['values']['fb_visible'];
  $data['fb_avatar'] = $form_state['values']['fb_avatar'];
  if ($op == $form['fbconnect']['unlink']['#value']) {
    if (fbconnect_unregister($fbuid)) {
      $data['fb_visible'] = null;
      $data['fb_avatar'] = null;

      // TODO remove this line before release module
      // remove inconsistent data
      $data['fbuid'] = null;
    }
  }
  if ($data) {
    user_save($account, $data);
  }
  drupal_set_message(t('Your configuration options have been saved.'));
}