You are here

function og_access_disable in Organic groups 5

Same name and namespace in other branches
  1. 5.8 og_access.install \og_access_disable()
  2. 5.3 og_access.install \og_access_disable()
  3. 5.7 og_access.install \og_access_disable()

Implementation of hook_disable().

A node access module needs to force a rebuild of the node access table when it is disabled to ensure that its entries are removed from the table.

File

./og_access.install, line 29

Code

function og_access_disable() {

  // This dodginess is fixed in core D6. Basically, we can't rebuild because we are still enabled.
  if (count(module_implements('node_grants')) == 1) {

    // Not using any other node_access modules. add the default grant.
    db_query("DELETE FROM {node_access}");
    db_query("INSERT INTO {node_access} VALUES (0, 0, 'all', 1, 0, 0)");
    cache_clear_all();
  }
  else {
    og_access_disabling(TRUE);
    node_access_rebuild();
  }
  drupal_set_message(t('The node access table has been rebuilt.'));
}