You are here

function template_preprocess_hybridauth_popup_loading in HybridAuth Social Login 7

File

./hybridauth.widget.inc, line 131

Code

function template_preprocess_hybridauth_popup_loading(&$vars, $hook) {
  $provider_id = $vars['provider_id'];
  $done = $vars['done'];
  $overlay = $vars['overlay'];
  $vars['throbber_url'] = url(drupal_get_path('module', 'hybridauth') . '/images/throbber.gif');
  $vars['destination'] = isset($_GET['destination']) ? $_GET['destination'] : 'user';
  if ($done && $overlay) {
    drupal_add_js('
      if (window.opener) {
        try { window.opener.parent.$.colorbox.close(); } catch(err) {}
        window.opener.parent.location.href = "' . url($vars['destination']) . '";
      }
      window.self.close();
    ', 'inline');
  }
  elseif ($done) {
    drupal_add_js('
      window.location.href = "' . url($vars['destination']) . '";
    ', 'inline');
    watchdog('hybridauth', print_r($vars, TRUE));
  }
  else {
    drupal_add_js('
      window.location.href = window.location.href + "&authenticate=1";
    ', 'inline');
  }
}