function shoutbox_group_get_group in Shoutbox 7.2
Same name and namespace in other branches
- 6.2 shoutbox_group/shoutbox_group.module \shoutbox_group_get_group()
- 7 shoutbox_group/shoutbox_group.module \shoutbox_group_get_group()
Determined by og_get_group_context for the block, or URL arg's for the page
Return value
The group currently in context, otherwise FALSE
2 calls to shoutbox_group_get_group()
- shoutbox_group_shoutbox in shoutbox_group/
shoutbox_group.module - Implementation of hook_shoutbox()
- _shoutbox_group_alter_form in shoutbox_group/
shoutbox_group.module - Alter the shoutbox add form Add the group ID to the shout form (if one)
File
- shoutbox_group/
shoutbox_group.module, line 234
Code
function shoutbox_group_get_group() {
static $group = FALSE;
// Retrieve the group if we haven't yet already
if (!$group) {
// First check og context for block view
if ($group = og_context()) {
return $group;
}
else {
if (arg(0) == 'shoutbox' && arg(1) == 'group' && is_numeric(arg(2))) {
// Check that arg(2) is a real group (already cleared as numeric value)
if ($node = node_load(arg(2))) {
// Make sure it's a group
if (og_is_group_type('node', $node->type)) {
$group = og_context('node', $node->nid);
// print "<pre>";
// print_r($group);
// print "</pre>";die();
//$group = og_get_group('node', $node->nid);
}
}
}
}
}
return $group;
}