function og_subgroups_og_create_links in Subgroups for Organic groups 6
Implementation of hook_og_create_links()
File
- ./
og_subgroups.module, line 294 - Maintains a hierarchy of groups created by the orgainc groups module.
Code
function og_subgroups_og_create_links($group) {
$links = array();
// See if the user is a group member
if (og_is_group_member($group->nid)) {
// Fetch all available node types
foreach (node_get_types() as $id => $type) {
// Check if this is a group type
if (og_is_group_type($id)) {
// Check if the user has permission to create this type
if (og_subgroups_can_edit_hierarchy($id) && node_access('create', $id)) {
$title = t('Create !name', array(
'!name' => $type->name,
));
$href = "node/add/" . str_replace('_', '-', $id);
$options = array(
'query' => "og_parent={$group->nid}",
);
$links["create_{$id}"] = l($title, $href, $options);
}
}
}
}
return $links;
}