Menu Block (or custom menu display): expand immediate children of active item I need to show a menu which only displays nodes one or two levels into the menu hierarchy, unless these nodes are immediate children of the node currently being viewed, in which case they should also be shown. (I explain what I'm after more fully in the lengthy 'example' below.) The Menu Block module almost lets me do this, but lacks a setting to expand the immediate children of active item. I added this as a feature request for Menu Block but have had no reply. Is there any way I can implement this myself, either using Menu Block or writing code to display the menus myself? Any code pointers would be very helpful.

(Background info: I'm using Drupal 7)

An example of what I'm after

Suppose you have a menu with these items (with the number of dashes before them representing their level):

-i1
--i2
--i3
---i4
---i5
----i6
--i7


If in Menu Block I set my menu block up with 'Starting level' = '1st level' and 'Maximum depth'=1 then it'll look like:

-i1
--i2
--i3
--i7


However, I'd like there to be an 'expand the immediate children of the active item' setting in Menu Block. If this setting were chosen then if the active item were i3 or i4 you should see:

-i1
--i2
--i3
---i4
---i5
--i7


And if it were i5 or i6 you'd see:

-i1
--i2
--i3
---i4
---i5
----i6
--i7
Like we figured out in the comments the problem was that the "Expand all children of this tree" option was checked for the menu block. Without checking this the children will only be shown if the user is on a related page, which was the desired result.