You are here

function template_preprocess_fb_autopost_facebook_profile in Facebook Autopost 7

Default preprocess implementation.

File

./fb_autopost.theme.inc, line 58
Theme implementation file for Facebook Autopost

Code

function template_preprocess_fb_autopost_facebook_profile(&$variables) {
  try {
    $fb = facebook_autopost();
    $fbuser_profile = $fb
      ->api('/' . $variables['fbprofile']['#fbprofile_id'] . '?fields=picture,id,name,link');
    $variables['fbprofile']['#fbprofile_name'] = empty($fbuser_profile['name']) ? $variables['fbprofile']['#fbprofile_id'] : $fbuser_profile['name'];
    $variables['fbprofile']['#fbprofile_link'] = empty($fbuser_profile['link']) ? 'http://facebook.com/' . $variables['fbprofile']['#fbprofile_id'] : $fbuser_profile['link'];
    $variables['fbprofile']['#fbprofile_picture'] = $fbuser_profile['picture'];
    $variables['fbprofile']['#fbprofile_logout_url'] = $fb
      ->getLogoutUrl(array(
      'next' => url('admin/config/services/fbautopost/logout', array(
        'absolute' => TRUE,
      )),
    ));
  } catch (FacebookApiException $e) {

    // Do nothing with the exception.
    watchdog('fb_autopost', $e
      ->getMessage(), array(), WATCHDOG_ERROR);
  }
}