function taxonomy_access_delete_default_grants in Taxonomy Access Control 7
Deletes module configurations for the given vocabulary IDs.
Parameters
int|array $vocab_ids: A single vocabulary ID or an array of vocabulary IDs.
int|null $rid: (optional) A single role ID. Defaults to NULL.
bool $update_nodes: (optional) A flag to determine whether nodes should be queued for update. Defaults to TRUE.
Return value
bool TRUE on success, or FALSE on failure.
Related topics
4 calls to taxonomy_access_delete_default_grants()
- taxonomy_access_disable_vocab in ./
taxonomy_access.module - Disables a vocabulary for the given role.
- taxonomy_access_enable in ./
taxonomy_access.install - Implements hook_enable().
- taxonomy_access_set_default_grants in ./
taxonomy_access.module - Updates vocabulary default grants for a role.
- taxonomy_access_taxonomy_vocabulary_delete in ./
taxonomy_access.module - Implements hook_taxonomy_vocabulary_delete().
File
- ./
taxonomy_access.module, line 1038 - Allows administrators to specify access control for taxonomy categories.
Code
function taxonomy_access_delete_default_grants($vocab_ids, $rid = NULL, $update_nodes = TRUE) {
// Accept either a single vocabulary ID or an array thereof.
if ($vocab_ids !== TAXONOMY_ACCESS_GLOBAL_DEFAULT && empty($vocab_ids)) {
return FALSE;
}
if ($update_nodes) {
// Cache the list of nodes that will be affected by this change.
$affected_nodes = _taxonomy_access_get_nodes_for_defaults($vocab_ids, $rid);
taxonomy_access_affected_nodes($affected_nodes);
unset($affected_nodes);
}
// The query builder will use = or IN() automatically as appropriate.
$query = db_delete('taxonomy_access_default')
->condition('vid', $vocab_ids);
if (!empty($rid)) {
$query
->condition('rid', $rid);
}
$query
->execute();
unset($query);
return TRUE;
}