function oa_core_node_prepare in Open Atrium Core 7.2
Implements hook_node_prepare().
Default the GId to current GID
File
- ./
oa_core.module, line 721
Code
function oa_core_node_prepare($node) {
if (empty($node->nid) && field_info_instance('node', OA_SPACE_FIELD, $node->type)) {
if (!empty($_GET['og_group_ref'])) {
$gid = $_GET['og_group_ref'];
}
else {
$gid = oa_core_get_space_context();
}
if ($gid && og_user_access('node', $gid, "create {$node->type} content")) {
$node->{OA_SPACE_FIELD}[LANGUAGE_NONE][0]['target_id'] = $gid;
}
}
}