Fix for Dynamically changing menu items on !$may_cache

  1.     foreach (taxonomy_get_vocabularies() as $vocabulary) {
  2.       if (_taxonomy_navigation_is_supported($vocabulary) && variable_get('taxonomy_navigation_show_' . $vocabulary->vid, 0)) {
  3.         // get parent settings
  4.         $pid = variable_get('taxonomy_navigation_pid_' . $vocabulary->vid, 0);
  5.  
  6.         $tree = taxonomy_get_tree($vocabulary->vid);
  7.         // build an array which holds all children of current term. necessary to build a proper 'or' value in the HREF
  8.         foreach ($tree as $term) {
  9.           $count = 0;
  10.           if (variable_get('taxonomy_navigation_nodes_' . $vocabulary->vid, TAXONOMY_NAVIGATION_DEFAULT_NUMBER_OF_NODES)) {
  11.             $count = _taxonomy_navigation_count($term->tid, variable_get('taxonomy_navigation_depth_' . $vocabulary->vid, 'all'));
  12.           }
  13.  
  14.           if ( ( $alias = drupal_get_path_alias('taxonomy/term/' . $term->tid) ) != 'taxonomy/term/' . $term->tid ) {
  15.             $item = array(
  16.                 'path' => drupal_get_path_alias('taxonomy/term/' . $term->tid),
  17.                 'title' => theme('taxonomy_navigation_menu_title', $term, $count),
  18.                 'access' => TRUE,
  19.                 'type' => MENU_NORMAL_ITEM,
  20.                 'weight' => variable_get('taxonomy_navigation_weight_' . $vocabulary->vid, -20) + $term->weight,
  21.                 'tid' => $term->tid,
  22.               );
  23.  
  24.             if ( $pid != 0 ) {
  25.               // If term has no parent, it means it's a root term
  26.               if (array_sum($term->parents) == 0) {
  27.                 $item['pid'] = $pid;
  28.               }
  29.             }
  30.             $items[] = $item;
  31.  
  32.             $items[] = array(
  33.                 'path' => 'taxonomy/term/' . $term->tid,
  34.                 'title' => t($term->name).$out,
  35.                 'callback' => 'taxonomy_navigation_page',
  36.                 'callback arguments' => array($term->tid, variable_get('taxonomy_navigation_depth_' . $vocabulary->vid, 'all')),
  37.                 'access' => user_access('access content'),
  38.                 'type' => MENU_CALLBACK,
  39.                 'tid' => $term->tid,
  40.               );
  41.           }
  42.  
  43.         }
  44.       }
  45.     }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.