function context_admin_term_parent_access_check in Contextual Administration 6
Check for access.
1 string reference to 'context_admin_term_parent_access_check'
- term_parent.inc in plugins/
access/ term_parent.inc - Plugin to provide access control based upon a term's parent tid.
File
- plugins/
access/ term_parent.inc, line 47 - Plugin to provide access control based upon a term's parent tid.
Code
function context_admin_term_parent_access_check($conf, $context) {
// Per the example in node type in core ctools
if (empty($context) || empty($context->data) || empty($context->data->tid)) {
return FALSE;
}
$acceptable_parents = explode(',', $conf['parent']);
$results = db_query("SELECT parent FROM {term_hierarchy} WHERE tid = %d", $context->data->tid);
while ($result = db_fetch_object($results)) {
if (in_array($result->parent, $acceptable_parents)) {
return TRUE;
}
}
if (empty($conf['parent'])) {
return FALSE;
}
return FALSE;
}