private function OgHeartbeat::setGroup in Heartbeat 6.4
setGroup
Sets the group for a given node ID.
Parameters
Integer $nid: The group node ID.
1 call to OgHeartbeat::setGroup()
- OgHeartbeat::construct in modules/
og_activity/ ogheartbeat.inc - Fake constructor to hook this method instead of the constructor.
File
- modules/
og_activity/ ogheartbeat.inc, line 72
Class
- OgHeartbeat
- Class OgHeartbeat Concrete class to prepare messages for the current user and all of his/her relations.
Code
private function setGroup($nid = 0) {
// Set the group by nid argument.
if ($nid != 0) {
$this->_gid = $nid;
$this->group = node_load($nid);
return;
}
elseif (!empty($_REQUEST['group_nid'])) {
$this->_gid = $_REQUEST['group_nid'];
$this->group = node_load($this->_gid);
}
// Set the group from the space.
if (module_exists('spaces_og')) {
if ($space = spaces_get_space()) {
if ($space->type == 'og') {
$this->_gid = $space->id;
$this->group = $space->group;
return;
}
}
}
// Set the group via current group context.
if ($group = og_get_group_context()) {
$this->_gid = $group->nid;
$this->group = $group;
return;
}
// Try to set the group from the node ID.
if (arg(0) == 'node' && is_numeric(arg(1))) {
if ($node = node_load(arg(1))) {
if (og_is_group_type($node->type)) {
$this->_gid = $node->nid;
$this->group = $node;
return;
}
elseif (og_is_group_post_type($node->type)) {
$this->_gid = current($node->og_groups);
$this->group = node_load($this->_gid);
return;
}
}
}
}