You are here

function taxonomy_access_disable in Taxonomy Access Control 5.2

Same name and namespace in other branches
  1. 5 taxonomy_access.module \taxonomy_access_disable()
  2. 7 taxonomy_access.module \taxonomy_access_disable()

Implementation of hook_disable().

Need to force a rebuild of the node access table when TAC is disabled to ensure that its entries are removed from the table.

File

./taxonomy_access.module, line 87
Allows administrators to specify how each category (in the taxonomy) can be used by various roles.

Code

function taxonomy_access_disable() {
  taxonomy_access_disabling(TRUE);
  $node_grants = module_implements('node_grants');

  // http://drupal.org/node/270202
  if (count($node_grants) == 1 && array_shift($node_grants) == 'taxonomy_access') {
    db_query("DELETE FROM {node_access}");

    // Not using any node_access modules. Add the default grant.
    db_query("INSERT INTO {node_access} VALUES (0, 0, 'all', 1, 0, 0)");
  }
  else {
    node_access_rebuild();
  }
}