function shs_add_term_access in Simple hierarchical select 7
Return access to create new terms.
Parameters
int $vid: ID of vocabulary to create the term in.
int $parent: ID of parent term (0 for top level).
string $field: Name of field requesting the term list (DOM element name).
object $account: The user to check access for.
Return value
bool TRUE or FALSE based on if user can create a term.
2 calls to shs_add_term_access()
- shs_json_term_add in ./
shs.module - Adds a term with ajax.
- shs_json_term_get_children in ./
shs.module - JSON callback to get the list of children of a term.
File
- ./
shs.module, line 1013 - Provides an additional widget for term fields to create hierarchical selects.
Code
function shs_add_term_access($vid, $parent = NULL, $field = NULL, $account = NULL) {
global $user;
if (!$account) {
$account = $user;
}
$access = module_invoke_all('shs_add_term_access', $vid, $parent, $field, $account);
return !in_array(FALSE, $access, TRUE) && (user_access('edit terms in ' . $vid, $account) || in_array(TRUE, $access));
}