You are here

function taxonomy_access_fix_menu_alter in Taxonomy access fix 7

Same name and namespace in other branches
  1. 7.2 taxonomy_access_fix.module \taxonomy_access_fix_menu_alter()

Implements hook_menu_alter().

Changes access callbacks and arguments for **some** (dubious) Taxonomy admin pages:

  • Vocabulary overview: if you have access to >= 1 vocabulary.
  • Vocabulary's terms overview: if you have access to edit or delete terms in this vocabulary.
  • Add vocabulary term: if you have the new "add terms in X" permission.

See also

taxonomy_access_fix_access()

File

./taxonomy_access_fix.module, line 124
This file contains all hooks and callbacks for extra/improved Taxonomy permissions.

Code

function taxonomy_access_fix_menu_alter(&$items) {

  // Vocabularies list.
  $item =& $items['admin/structure/taxonomy'];
  $item['access callback'] = 'taxonomy_access_fix_access';
  $item['access arguments'] = array(
    'index',
  );

  // Terms list in vocabulary.
  $item =& $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name'];
  $item['access callback'] = 'taxonomy_access_fix_access';
  $item['access arguments'] = array(
    'list terms',
    3,
  );

  // Add term to vocabulary.
  $item =& $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/add'];
  $item['access callback'] = 'taxonomy_access_fix_access';
  $item['access arguments'] = array(
    'add terms',
    3,
  );
}