function tft_og_tft_get_add_content_links_alter in Taxonomy File Tree 7.2
Implements hook_tft_get_add_content_links_alter().
Check permissions against the OG groups. This is pretty much a verbatim copy of tft_get_add_content_links.
See also
File
- modules/
tft_og/ tft_og.module, line 135 - Hook implementations for TFT OG.
Code
function tft_og_tft_get_add_content_links_alter(&$links, $tid) {
$setting = tft_get_file_setting();
$add_file_query = array(
'destination' => $_SESSION['tft']['q'],
);
$add_term_query = array(
'destination' => $_SESSION['tft']['q'],
);
$setting = tft_get_file_setting();
// Do we have a tid ?
if ($tid) {
$add_file_query['tid'] = $tid;
$add_term_query['parent'] = $tid;
}
$gid = tft_og_get_og_nid($tid);
if (!$gid) {
return;
}
// Can the user create files ?
if (og_user_access('node', $gid, 'create ' . $setting['type'] . ' content') && og_user_access('node', $gid, TFT_PERM__ADD_FILE)) {
if (!empty($gid)) {
$add_file_query['og_group_ref'] = $gid;
}
$links['add_file'] = array(
'title' => t("Add a file"),
'href' => 'node/add/' . str_replace('_', '-', $setting['type']),
'attributes' => array(
'id' => 'add-child-file',
),
'query' => array_reverse($add_file_query),
);
}
if (og_user_access('node', $gid, TFT_PERM__ADD_TERMS)) {
$links['add_term'] = array(
'title' => t("Add a folder"),
'href' => 'tft/term/add',
'attributes' => array(
'id' => 'add-child-folder',
),
'query' => array_reverse($add_term_query),
);
}
}