You are here

function fboauth_init in Facebook OAuth (FBOAuth) 7.2

Implements hook_init().

File

./fboauth.module, line 45

Code

function fboauth_init() {
  global $user;
  if (variable_get('fboauth_always_load_js', 0)) {
    $url = drupal_parse_url(request_uri());
    if (drupal_match_path($url['path'], '/user/' . $user->uid . '/fboauth')) {
      $fbid = fboauth_fbid_load($user->uid);
      if ($fbid !== FALSE) {

        // We have a fbid so must be displaying the deauth button, no need for
        // the popup window.
      }
      else {
        drupal_add_js(drupal_get_path('module', 'fboauth') . '/fboauth_popup.js');
      }
    }
    elseif (!drupal_match_path($url['path'], '/user/' . $user->uid . '/fboauth')) {
      drupal_add_js(drupal_get_path('module', 'fboauth') . '/fboauth_popup.js');
    }
  }
}