You are here

function fbconnect_user_settings_form_submit in Facebook Connect 6.2

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

Handle post-validation user_settingsForm submission.

File

./fbconnect.pages.inc, line 264
User pages callbacks for the fbconnect module.

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;
    }
    else {
      form_set_error('fbconnect', t("Something went wrong. Can't unlink account"));
    }
  }
  if ($data) {
    user_save($account, $data);
  }
  drupal_set_message(t('Your configuration options have been saved.'));
}