You are here

function fbconnect_fbapp_settings_submit in Facebook Connect 6.2

Same name and namespace in other branches
  1. 8.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()

@todo.

1 string reference to 'fbconnect_fbapp_settings_submit'
fbconnect_fbapp_settings in ./fbconnect.admin.inc
@todo.

File

./fbconnect.admin.inc, line 266
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 (!fbconnect_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 = fbconnect_facebook_client()
      ->api(array(
      'method' => 'admin.setAppProperties',
      'properties' => 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'));
  }
}