[development] Two tiered menus in D7 when the top level is user specific

Rob Thorne rob at torenware.com
Tue Mar 22 00:55:03 UTC 2011

I'm looking into a two tiered menu in a D7 application where the second
level of the menu is standard, but the top level is different for every

To make this concrete, suppose the user is a teacher at a school where
the teacher uses multiple rooms, and needs to order materials for each
room separately.  Each teacher has a separate list of rooms, but the the
pages we track -- class lists, crafts inventory, furniture... are the
same for each room.

So for teacher A, we might have a set of menus like this:

    * Room 220
          o Class List
          o Crafts Inventory
          o Furniture
    * Room 221
          o Class List
          o Crafts Inventory
          o Furniture

and so on.  It's clear to me how to do a loader function and menu
handler for a link like 'teacher/%teacher/room/%/class_list', but I
don't see how to populate the level of the menus for '220' and '221' in
the 3 position.

In Drupal 5, I used to use the !$may_cache argument for these sorts of
things.  I'm not arguing that this was efficient, but it did work.  What
hooks would I need to use in addition to hook_menu to make this work in
Drupal 7?

Rob Thorne
Torenware Networks

More information about the development mailing list