You are here

function og_session_context_set_context in OG Session Context 7

Determines the og context value for og_session_context_og_context_handler_sessions by looking the entity's node value or the og_group_ref field value on space and space content page.

2 calls to og_session_context_set_context()
og_session_context_exit in ./og_session_context.module
Implements hook_exit().
og_session_context_og_context_handler_sessions in ./og_session_context.module
Callback to pass the og context value based on the last space or space content page visited.

File

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

Code

function og_session_context_set_context($group) {
  global $user;

  // don't create a session for anonymous users unless session already started
  // needed to allow Varnish to cache anonymous pages
  if ($user->uid == 0 && !drupal_session_started()) {
    return;
  }
  if ($group) {
    $_SESSION[OG_SESSION_CONTEXT_ID] = $group;
  }
}