You are here

function fbconnect_login_user_settings_form_submit in Facebook Connect 7.2

Same name and namespace in other branches
  1. 8.2 fbconnect_login/fbconnect_login.pages.inc \fbconnect_login_user_settings_form_submit()

Handle post-validation user_settingsForm submission.

File

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

Code

function fbconnect_login_user_settings_form_submit($form, &$form_state) {
  $account = $form_state['values']['account'];
  $data['data']['fb_visible'] = $form_state['values']['fb_visible'];
  $data['data']['fb_avatar'] = $form_state['values']['fb_avatar'];
  if ($form_state['values']['op'] == $form['fbconnect']['unlink']['#value']) {
    if (fbconnect_login_unregister($account->fbuid)) {
      unset($data);
    }
    else {
      form_set_error('fbconnect', t("Something went wrong. Can't unlink account"));
    }
  }
  if (isset($data)) {
    user_save($account, $data);
  }
  drupal_set_message(t('Your configuration options have been saved.'));
}