You are here

function fb_app_set_app_properties in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 5.2 fb_app.module \fb_app_set_app_properties()
  2. 6.3 fb_app.admin.inc \fb_app_set_app_properties()
  3. 7.3 fb_app.admin.inc \fb_app_set_app_properties()

Sets callback URLs and other properties of a facebook app. Calls the facebook

1 call to fb_app_set_app_properties()
fb_app_admin_form_submit in ./fb_app.admin.inc

File

./fb_app.admin.inc, line 307

Code

function fb_app_set_app_properties($fb_app) {
  $data = fb_get_app_data($fb_app);
  $fb_app_data = $data['fb_app'];
  $props = fb_invoke(FB_ADMIN_OP_SET_PROPERTIES, array(
    'fb_app' => $fb_app,
  ), array(), FB_ADMIN_HOOK);
  if (count($props)) {
    if ($fb_app_data['set_app_props']) {
      if ($fb = fb_api_init($fb_app, FB_FBU_CURRENT)) {
        try {
          $fb->api_client
            ->admin_setAppProperties($props);
          drupal_set_message(t('Note that it may take several minutes for property changes to propigate to all facebook servers.'));
          if (fb_verbose()) {
            drupal_set_message(t('Set the following properties for %label application:<br/><pre>!props</pre>', array(
              '%label' => $fb_app->label,
              '!props' => print_r($props, 1),
            )));
            watchdog('fb_app', 'Set facebook app properties for %label.', array(
              '%label' => $fb_app->label,
            ), WATCHDOG_NOTICE, l(t('view apps'), FB_PATH_ADMIN));
          }
        } catch (Exception $e) {
          fb_log_exception($e, t('Failed to set application properties on Facebook'));
        }
      }
    }
    elseif (fb_verbose()) {
      drupal_set_message(t('The following recommended properties for %label application have <strong>not been set automatically</strong>, consider editing remote settings manually:<br/><pre>!props</pre>', array(
        '%label' => $fb_app->label,
        '!props' => print_r($props, 1),
      )), 'warning');
    }
  }
}