You are here

function fbconnect_init in Facebook Connect 6.2

Same name and namespace in other branches
  1. 6 fbconnect.module \fbconnect_init()

Implements hook_init().

File

./fbconnect.module, line 104
Integration with Facebook Connect API.

Code

function fbconnect_init() {
  fbconnect_render_js();
  $conf = fbconnect_get_config();
  if ($conf && fbconnect_facebook_client() && user_is_anonymous()) {
    if ($conf['loginout_mode'] == 'auto') {
      $fbuid = fbconnect_get_fbuid();
      if ($fbuid && _fbconnect_is_user($fbuid)) {
        $form_state = array(
          'values' => array(
            'op' => 'connect',
          ),
        );
        drupal_execute('fbconnect_autoconnect_form', $form_state);
        drupal_goto($form_state['redirect']);
      }
    }
  }

  // During registration the cache is disabled.
  if (arg(0) == 'fbconnect' && arg(1) == 'register') {
    $GLOBALS['conf']['cache'] = FALSE;
  }
}