You are here

function taxonomy_access_admin_delete_role in Taxonomy Access Control 5.2

Same name and namespace in other branches
  1. 6 taxonomy_access.admin.inc \taxonomy_access_admin_delete_role()
2 string references to 'taxonomy_access_admin_delete_role'
taxonomy_access_admin in ./taxonomy_access_admin.inc
Menu callback; presents the category permissions page of TAC (admin/user/taxonomy_access).
taxonomy_access_menu in ./taxonomy_access.module
Implementation of hook_menu

File

./taxonomy_access_admin.inc, line 72
Administrative interface for taxonomy access control.

Code

function taxonomy_access_admin_delete_role($rid) {
  if (is_numeric($rid) and $rid > 2 and db_fetch_array(db_query('SELECT rid FROM {term_access_defaults} WHERE vid=0 AND rid=%d', $rid))) {
    if ($_POST['confirm']) {

      // issue #167977 - klance
      $affected_nodes = _taxonomy_access_get_nodes_for_role($rid);
      db_query('DELETE FROM {term_access} WHERE rid=%d', $rid);
      db_query('DELETE FROM {term_access_defaults} WHERE rid=%d', $rid);

      // issue #167977 - klance

      //node_access_rebuild();
      _taxonomy_access_node_access_update($affected_nodes);
      drupal_set_message("All term access rules deleted for role {$rid}.");
      drupal_goto('admin/user/taxonomy_access');
    }
    else {
      return confirm_form($form, t('Are you sure you want to delete all grant rules for role %rid?', array(
        '%rid' => $rid,
      )), 'admin/user/taxonomy_access', t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
    }
  }
  else {
    return drupal_not_found();
  }
}