function _taxonomy_access_node_access_update in Taxonomy Access Control 6
Same name and namespace in other branches
- 5.2 taxonomy_access.module \_taxonomy_access_node_access_update()
- 7 taxonomy_access.module \_taxonomy_access_node_access_update()
Updates node access grants for a set of nodes.
Parameters
$nids: An array of node ids for which to acquire access permissions.
3 calls to _taxonomy_access_node_access_update()
- taxonomy_access_admin_delete_role in ./
taxonomy_access.admin.inc - Form callback to delete all access rules for a particular role.
- taxonomy_access_admin_form_submit in ./
taxonomy_access.admin.inc - Submit handler for the administration form at admin/user/taxonomy_access.
- taxonomy_access_taxonomy in ./
taxonomy_access.module - Implements hook_taxonomy().
File
- ./
taxonomy_access.module, line 509 - Allows administrators to specify how each category (in the taxonomy) can be used by various roles.
Code
function _taxonomy_access_node_access_update($nids) {
// Proceed only if node_access_needs_rebuild() is not already flagged.
if (!node_access_needs_rebuild()) {
// Set node_access_needs_rebuild() until we succeed below.
node_access_needs_rebuild(TRUE);
// Remove any duplicate nids from the array.
$nids = array_unique($nids);
// If the number of nodes is small enough, update node access for each.
if (sizeof($nids) < TAXONOMY_ACCESS_MAX_UPDATE) {
foreach ($nids as $node) {
$loaded_node = node_load($node, NULL, TRUE);
if (!empty($loaded_node)) {
node_access_acquire_grants($loaded_node);
}
}
// If we make it here our update was successful; unflag rebuild.
node_access_needs_rebuild(FALSE);
}
}
return TRUE;
}