You are here

function fbconnect_fbapp_settings_submit in Facebook Connect 6

Same name and namespace in other branches
  1. 8.2 fbconnect.admin.inc \fbconnect_fbapp_settings_submit()
  2. 6.2 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 206
Administration page callbacks for the fbconnect module.

Code

function fbconnect_fbapp_settings_submit($form, &$form_state) {
  $properties = array(
    'connect_url' => $form_state['values']['fbconnect_connect_url'],
    'base_domain' => $form_state['values']['fbconnect_base_domaine'],
    'uninstall_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 {
    $res = facebook_client()->api_client
      ->admin_setAppProperties(array_filter($properties));
  } catch (Exception $e) {
    drupal_set_message(t('Exception thrown while using admin_setAppProperties : @code', array(
      '@code' => $e
        ->getMessage(),
    )), 'error');
  }
  if (!$res) {
    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'));
  }
}