You are here

function og_session_context_og_context_handler_sessions in OG Session Context 7

Callback to pass the og context value based on the last space or space content page visited.

1 string reference to 'og_session_context_og_context_handler_sessions'
og_session_context_og_context_negotiation_info in ./og_session_context.module
Implements hook_og_context.negotiation_info()

File

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

Code

function og_session_context_og_context_handler_sessions() {
  $group = og_session_context_get_context();

  // if we can't get the group from the node, look in session variable
  if (!$group && !empty($_SESSION[OG_SESSION_CONTEXT_ID])) {
    $group = $_SESSION[OG_SESSION_CONTEXT_ID];
  }
  og_session_context_set_context($group);

  // update the session variable
  $gids = FALSE;

  // don't call node_load or check node access because this can be called
  // early during batch processing
  if ($group) {
    $gids['node'][0] = $group;
  }
  return $gids;
}