You are here

function fbconnect_init in Facebook Connect 6

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

Implementation of hook_init().

File

./fbconnect.module, line 502

Code

function fbconnect_init() {
  fbconnect_render_js();
  $conf = fbconnect_get_config();
  if ($conf['loginout_mode'] == 'auto' && user_is_anonymous()) {
    $fbuid = fbconnect_get_fbuid();
    if ($fbuid && _is_fbconnect_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;
  }
}