After installing and enabling Menu Trails on Drupal 6.10, I get a blank browser window when I try to go to
http://tap.resultsfordevelopment.org/drupal/admin/settings/menutrails

I'm assuming there is some kind of php error. Also when viewing pages on the site I get the following error.
"warning: Invalid argument supplied for foreach() in /home/www/tap.resultsfordevelopment.org/drupal/sites/all/modules/menutrails/menutrails.module on line 130."

I tried commenting out the following lines from menutrails.module. The warning I received on front end pages went away, but the blank screen for the admin page still occurs.

//    foreach ($node->taxonomy as $term) {
//     if ($term_trails[$term->tid]) {
//        $href = $term_trails[$term->tid];
//      }
//    }

Any assistance in pinpointing the cause of the problem would be greatly appreciated.

Comments

jim kirkpatrick’s picture

Category: support » bug
Status: Active » Needs work

There are a couple of bugs caused by Menutrails unfortunately assuming the presence of the Taxonomy module, so when it's not things go bang. The admin screen blows up on 252 for a similar reason.

I've made a fix by:

  • Wrapping the foreach block at line 130 with an if statement:
      if ($node->taxonomy) {
        foreach ($node->taxonomy as $term) {
          if ($term_trails[$term->tid]) {
            $href = $term_trails[$term->tid];
          }
        }
      }
    
  • Wrapping the request to get taxonomy vocabularies on line 252 with a module_exists check:
      if (module_exists("taxonomy")) {
        $vocabs = taxonomy_get_vocabularies();
      }
    
  • Similar on line 270 now that $vocabs can be empty:
      if ($vocabs) {
        foreach ($vocabs as $vocab) {
          if ($vocab->tags != 1) {
            // tagging gets out of hand too fast, so we disallow
            $form[$vocab->vid]['menutrails_terms'] = array(
              '#tree' => TRUE,
              '#type' => 'fieldset',
              '#collapsible' => TRUE,
              '#collapsed' => TRUE,
              '#title' => t('Categories:') ." $vocab->name",
            );
            $terms = taxonomy_get_tree($vocab->vid);
            foreach ($terms as $term) {
               $form[$vocab->vid]['menutrails_terms'][$term->tid] = array('#type' => 'select',
                '#title' => t('Parent item for') ." $term->name",
                '#default_value' => $term_trails[$term->tid],
                '#options' => $options,
              );
            }
          }
        }
      }
    

After the above 3 checks are added, there are no more problems for me.

Jim

jim kirkpatrick’s picture

Status: Needs work » Closed (duplicate)

Ahhh bugger. I spotted the above is already reported (and fixed in dev) in #313556: Missing dependency declaration for taxonomy module just after I posted the above.

nessumsara’s picture

Sorry for the delayed response. I implemented the dev version and now it works fine. Thanks for saving my day and thanks to Josh K for fixing the problem!!

geek-merlin’s picture

subscribing