I'm using two menus on every page: Main, for my main navigation, and Breadcrumb, for my breadcrumb trail.

Main lists some nodes outside their parent items. Breadcrumb lists them correctly. I'm trying to use Menu Breadcrumb to override the use of Main for the breadcrumb trail, but it's not working. I've disabled all menus except for Breadcrumb in the module's administration panel, placed it first and Main last, and yet it's still picking up Main. If, in Main, I delete the links for the incorrectly nested nodes, the trail corrects itself. This is not a workable solution, though, and seems to defeat the purpose of being able to set which menu I'd like to use as my breadcrumb trail.

All other settings seem to work as intended, except for the order and enabling/disabling. Any ideas?

Comments

I´ve debugged the problem today. I'm using Drupal 7, Menu Breadcrumb 7.x-1.3 and the Admin Menu module (http://drupal.org/project/admin_menu). In my case the faulty breacrumbs are created for pages which are included in two menus (one enabled, one disabled in module settings).

$active_menus = menu_get_active_menu_names();

In my drupal installation this function call has a return value with all possible menus included. Changing this line to an empty array as value solves the problem for me.

$active_menus = array();

Probably I'm causing other problems doing this, but it seems to work for me.

Version:7.x-1.3» 6.x-1.3

Doesn't work on 1.3 as well. Only enabled the menu to be used for breadcrumbs and it still picks up the 'Primary Links' menu -- though i disabled the 'Primary Links' menu in menu_breadcrumb admin panel and also put at the top the custom menu for breadcrumbs.

Version:6.x-1.3» 7.x-1.3

...alright. After hours of research, I realized that it's in conflict with menu trails module. I just turned off that module since I'm not really using that anyway.

Sad, I also cannot use this nice module because of menu trail conflict... This is real bug in latest DRUPAL 7.x. Also this is not a bug of menu BC. This is related with DRUPAL CORE.

Actually, i had the same issue with a breadcrumb coming up from a menu i disabled in the settings of menu breadcrumb.

Then i looked at the code, and actually the bug looks like fixed this way:

<?php
foreach (array_keys($menu_list) as $menu_name) {
     
$is_pattern = (substr($menu_name, 0, 1) == '/' && substr($menu_name, -1, 1) == '/');
      if (
$is_pattern) {
       
// Look for each of the $menu_link_menus in the pattern match cache.
       
foreach (array_keys($menu_link_menus) as $menu_link_menu_name) {
          if (
array_key_exists($menu_link_menu_name, $match_cache)
              &&
$match_cache[$menu_link_menu_name] == $menu_name) {
           
menu_set_active_menu_names($menu_link_menu_name);
            break
2;
          }
        }
      }
      else {
        if (
array_key_exists($menu_name, $menu_link_menus)) {
         
$active_menus = menu_get_active_menu_names();
         
$active_menus[] = $menu_name;
         
$breadcrumb_menus = menu_breadcrumb_menu_list();
          foreach(
$breadcrumb_menus as $bread_item=>$val){
            if(
$val == TRUE){
             
$my_active_menus[] = $bread_item;
            }
          }
          foreach(
$active_menus as $list=>$menu){
            if(!
in_array($menu, $my_active_menus)){
              unset(
$active_menus[$list]);
            }
          }
         
menu_set_active_menu_names($active_menus);
          break;
        }
      }
    }
?>

basically, it looks to me that calling directly menu_set_active_menu_names($active_menus); by setting $active_menus = menu_get_active_menu_names(); doesn't actually filter the menus enabled and not... does it?

Hi everyone,

This patch adds our menu_name at the beggining of the menu list returned by "menu_get_active_menu_names" instead of the end, so that our menu is highest priority in all sub treatments ( because at this point, our menu_name is the first encountered in our "menu_breadcrumb_menu_list" array ).

Doing so, the "active menu" in our breadcrumb is well affected by our configuration on the menu_breadcrumb configuration !

Hope it helps,
Sincerely,
Bastien.

Status:Active» Needs review
StatusFileSize
new728 bytes

Hi everyone,

This patch adds our menu_name at the beggining of the menu list returned by "menu_get_active_menu_names" instead of the end, so that our menu is highest priority in all sub treatments ( because at this point, our menu_name is the first encountered in our "menu_breadcrumb_menu_list" array ).

Doing so, the "active menu" in our breadcrumb is well affected by our configuration on the menu_breadcrumb configuration !

Hope it helps,
Sincerely,
Bastien.

It works. Thks.

Status:Needs review» Reviewed & tested by the community

#6 should be committed, this bug is quite annoying, and I noticed it in another module "Custom Breadcrumb" as well.

Alright.. After spending hours of research, I realised that, menu breadcrumb conflicts with menu_trail_by_path module. When I disabled it, it works fine for me.
Same thing with custom breadcrumb, it was not displaying breadcrumb which I have set but when I disabled menu_trail_by_path module, custom breadcrumb also works fine for me.. :)
This may help to someone. :)

Here is the same patch with 2 minor changes:
* No unnecessary indentation change on one of the lines.
* Adhere to coding standards for comment formatting.

Functionality remains unchanged.

I also confirm that it fixes a major problem.

Patch in #11 has been tested and fixes this problem.

#11 worked for me. Roll it...

StatusFileSize
new1.06 KB

Here's even better one. This one fixes the bug with regexp matching: menu_set_active_menu_names() expects array, not a single menu item.

@neochief:

Seems like you might be fixing 2 issues in one.
Usually it is best to fix one bug per issue.

Assigned:Unassigned» vaibhavjain

Status:Reviewed & tested by the community» Closed (fixed)

Patch commited.