function og_context in Organic groups 7
Same name and namespace in other branches
- 7.2 og_context/og_context.module \og_context()
Get or set group context using the menu system.
Parameters
$group: Optional; The group entity to set as the context.
Return value
A group entity, or FALSE if no context was found.
6 calls to og_context()
- og_context_create_og_group in og_context/
og_context.module - Return OG group form context.
- og_context_get_properties in og_context/
og_context.module - Property getter callback.
- og_context_init in og_context/
og_context.module - Implement hook_init().
- og_context_plugin_access_og_perm::access in og_context/
includes/ views/ og_context_plugin_access_og_perm.inc - Determine if the current user has access or not.
- og_context_plugin_argument_default_group_context::get_argument in og_context/
includes/ views/ og_context_plugin_argument_default_group_context.inc - Return the group context argument.
3 string references to 'og_context'
- og_context_og_invalidate_cache in og_context/
og_context.module - Implements hook_og_invalidate_cache().
- og_context_views_api in og_context/
og_context.module - Implements hook_views_api().
- og_uninstall in ./
og.install - Implements hook_uninstall().
File
- og_context/
og_context.module, line 301 - Get a group from a viewed page.
Code
function og_context($group = NULL) {
global $user;
$context =& drupal_static(__FUNCTION__, FALSE);
if (!empty($group)) {
$context = $group;
}
if (empty($context)) {
// Get context from context handlers.
if (($context = og_context_determine_context()) && $user->uid) {
// TODO: Add option to save session for anonymous users as-well?
// Save the group ID in the authenticated user's session,
$_SESSION['og_context'] = $context->gid;
}
}
return $context;
}