You are here

function fbconnect_profile_user_settings_submit in Facebook Connect 5

File

modules/fbconnect_profile/fbconnect_profile.module, line 138
This module allows users to import their personal information from Facebook.

Code

function fbconnect_profile_user_settings_submit($form, &$form_state) {
  $user = user_load(array(
    'uid' => arg(1),
  ));
  $conf = (array) $form_state['import_setting'];
  if ($fields = array_filter($conf, 'fbconnect_import_filter')) {
    fbconnect_profile_insert_user_info($user->uid, $fields);
  }
  else {
    db_query("UPDATE {fbconnect_users} SET import_setting = '' WHERE uid = %d", $user->uid);
    db_query('DELETE FROM {fbconnect_profile} WHERE uid = %d', $user->uid);
  }
  drupal_set_message('Your Facebook connect settings have been saved.');
  drupal_goto('user/' . $user->uid);
}