You are here

function og_session_context_exit in OG Session Context 7

Implements hook_exit().

File

./og_session_context.module, line 107
Provides hook implementations and functionality for og_session_context.

Code

function og_session_context_exit($destination = NULL) {

  // This can be called before Drupal sessions are bootstrapped
  require_once DRUPAL_ROOT . '/' . variable_get('session_inc', 'includes/session.inc');

  // Skip call to context if we have no session.
  global $user;
  if ($user->uid == 0 && !drupal_session_started()) {
    return;
  }

  // Ensure the latest og_context has been saved to the session.
  $context = og_context('node');
  if (!empty($context['gid'])) {
    og_session_context_set_context($context['gid']);
  }
}