You are here

function fbconnect_login_init in Facebook Connect 8.2

Same name and namespace in other branches
  1. 7.2 fbconnect_login/fbconnect_login.module \fbconnect_login_init()

Implements hook_init().

File

fbconnect_login/fbconnect_login.module, line 11
Login functionality for Facebook Connect module

Code

function fbconnect_login_init() {
  fbconnect_render_js();
  $conf = fbconnect_get_config();
  if ($conf && facebook_client() && user_is_anonymous()) {
    if ($conf['loginout_mode'] == 'auto') {
      $fbuid = fbconnect_get_fbuid();
      if ($fbuid && _is_fbconnect_user($fbuid) && fbconnect_user_profile()) {
        $form_state = array(
          'values' => array(
            'op' => 'connect',
          ),
        );
        drupal_form_submit('fbconnect_login_autoconnect_form', $form_state);
        drupal_goto($form_state['redirect']);
      }
    }
  }

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