I have 2 menus in my site :

  • main-menu : home - blog (/blog)
  • blog-menu : All categories(/blog) - Cat 1(/blog/cat-1) - Cat 2(/blog/cat-2)

My node's path are base on taxonomy but the active trail don't work for the 2 menus.
For exemple, my node's path is "/blog/cat-2/node-name".

The main-menu "blog" is active, this is great.
The blog-menu is not active, nor the "All categories" or the "Cat 2".

I check the code & the sql query didn't result correctly.

$results = db_select('menu_links','ml')
    ->fields('ml',array('menu_name','link_path','link_title','depth'))
    ->condition('link_path',$parent_candidates_normal_paths,'IN')
    ->execute();

Drupal (but with mysql it's ok) find :

  • main-menu : /blog (ok)
  • blog-menu : /blog (not ok, missing /blog/cat-2)

The function menu_tree_set_path($menu_name, $menu_link['link_path']) works with the main-menu, but not for the blog-menu, "All Categories" is not active (but in fact, I need Cat 2 to set active).

I'm using Drupal 7.9 & the last version of this module.
Sorry if not clear, it's hard for me in english.

Comments

SeriousMatters’s picture

Hi Errance,

I think you are seeing the Custom menus never receive an active trail problem in Drupal core.

Try this quick fix module:
custom_menu_active_trail.

SeriousMatters’s picture

Assigned: Unassigned » SeriousMatters
Status: Active » Closed (fixed)

To make life easier for everyone, I am incorporating mattfarina's fix in Menu Trail by Path.

Pushed to 7.x-2.x-dev branch.

gilles_c’s picture

Don't change anything for me. :-(

SeriousMatters’s picture

Status: Closed (fixed) » Fixed

Seems like mattfarina's fix only take effect when adding or updating menu. Errance, try to edit the custom menu in question and save it to trigger the fix.

gilles_c’s picture

I edit my custom menu & create a new one but nothing.

If my node's path is "/blog/cat-2/node-name", the bold are active.

  • main-menu : home - blog (/blog)
  • blog-menu : All categories(/blog) - Cat 1(/blog/cat-1) - Cat 2(/blog/cat-2)

If I add the node to the menu :

  • main-menu : home - blog (/blog)
  • blog-menu : All categories(/blog) - Cat 1(/blog/cat-1) - Cat 2(/blog/cat-2) - Node (/blog/cat-2/node-name)

I also try to remove the main menu but nothing change...

SeriousMatters’s picture

Errance,

1. Ensure you are using Drupal7.9 +
2. Update Menu Trail By Path to the latest version (beta3 at time of this post).
3. Go to: /admin/structure/menu/manage/blog-menu/edit and click save (to activate the core bug fix)
4. Use Firebug to check for 'active-trail' class on /blog & /blog/cat-2 (not 'active' class)

If you are sure that you have done the steps above but active-trail is still not working properly, can you link me to your site? or provide the steps to reproduce the same issue from a fresh installation of Drupal7.9?

arski’s picture

Status: Fixed » Active

Hey there,

Don't know if this should go in here, but I have the opposite issue: I also have two menus, the main menu just points to the top level /foo and then an additional menu in a menu block that has /foo/bar etc links.. The second menu works fine, but the main menu doesn't.

Maybe it's relevant, but the 'foo' path in the main menu is defined in a module using hook_menu and it redirects to the first '/foo/bar' link - still, it should work shouldn't it?

Using D7.9, latest rc of your module, and checked steps 2,4 above as well.

Thanks

gilles_c’s picture

I've just finish my website & put it on the web.

For example :
http://www.sinfulgarden.com/blog/livres
http://www.sinfulgarden.com/blog/livres/art-de-lenluminure-39

On the left menu in the second link, 'Livre' isn't active.

I have a Drupal 7.10 & a Menu Trail 7.x-2.0-rc1

SeriousMatters’s picture

Errance,

Can you confirm that you have re-saved your custom menu to trigger the fix as per step 3 above ?

Your site looks nice and calm. =)

gilles_c’s picture

I've done the #6.
I also try with a new menu, but won't work.
I'll try to find time this week to test with all the other modules deactivated.

Thanks for liking my website. :)

SeriousMatters’s picture

Seems like we have a commit to fix this problem in core. The whole problem may finally be solved in D7.11 . =)

SeriousMatters’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.