You are here

function fbconnect_fbapp_settings_submit in Facebook Connect 8.2

Same name and namespace in other branches
  1. 6.2 fbconnect.admin.inc \fbconnect_fbapp_settings_submit()
  2. 6 fbconnect.admin.inc \fbconnect_fbapp_settings_submit()
  3. 7.2 fbconnect.admin.inc \fbconnect_fbapp_settings_submit()
1 string reference to 'fbconnect_fbapp_settings_submit'
fbconnect_fbapp_settings in ./fbconnect.admin.inc

File

./fbconnect.admin.inc, line 294
Administration page callbacks for the fbconnect module.

Code

function fbconnect_fbapp_settings_submit($form, &$form_state) {
  $properties = array(
    'website_url' => $form_state['values']['fbconnect_connect_url'],
    'app_domains' => array(
      $form_state['values']['fbconnect_base_domaine'],
    ),
    'deauth_callback_url' => $form_state['values']['fbconnect_uninstall_url'],
  );
  if (!facebook_client()) {
    drupal_set_message(t('Unable to get a Facebook client, check your api key'), 'error');
    return FALSE;
  }
  if (!fbconnect_get_fbuid()) {
    drupal_set_message(t('Unable to autoconfigure your application settings, make sure you are logged into Facebook'), 'warning');
    return FALSE;
  }
  try {
    $fb_appid = variable_get('fbconnect_appid', NULL);
    $res = fbconnect_graph_query('/' . $fb_appid, $properties, 'POST', TRUE)
      ->asArray();
  } catch (Exception $e) {
    drupal_set_message(t('Exception thrown while using admin_setAppProperties : @code', array(
      '@code' => $e
        ->getMessage(),
    )), 'error');
  }
  if (empty($res['success'])) {
    drupal_set_message(t('Checking your Facebook session, you are not allowed to change this application settings'), 'error');
  }
  else {
    drupal_set_message(t('Your Facebook app settings has been updated'));
  }
}