You are here

function fbconnect_user_settings_form_submit in Facebook Connect 5

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

Handle post-validation user_settingsForm submission.

File

./fbconnect.module, line 475
This module allows site visitors to connect and register with facebook account

Code

function fbconnect_user_settings_form_submit($form, &$form_state) {
  $user = user_load(array(
    'uid' => arg(1),
  ));
  $form_value_visi = $form_state['visibility'];
  if ($user->fb_visibility != $form_value_visi) {
    fbconnect_set_user_visibility($user, $form_value_visi);
  }
  if (variable_get('user_pictures', 0)) {
    $db_value = fbconnect_user_avatar_setting($user->uid);
    $form_value = $form_state['fb_avatar'];
    if ($form_value && fbconnect_get_fbuid()) {
      fbconnect_refresh_user_avatar($user->fbuid, $user->uid);
    }
    if ($form_value != $db_value) {

      // Update avatar settings.
      fbconnect_user_avatar_setting($user->uid, $form_value);
    }
  }

  // Redirect to user profile.
  if (!module_exists('fbconnect_profile')) {
    drupal_set_message('Your Facebook connect settings have been saved.');
    drupal_goto('user/' . $user->uid);
  }
}