I'm building a module for which I want to create two dynamic menus: one main menu with each menu item being a group name that the user belongs to (the groups come from a different database) and a secondary menu with a fixed set of menu items that manipulate specific properties of the group selected in the main menu (for example show group members).
What would be a good approach to do this? I found this question that shows how to create a menu within a module, but I'm not sure how to tackle the dynamic part of the menu items. Each user can have a different main menu, depending on the groups the user is part of, and the secondary menu items need to pass the group id of the selected main menu item. Next to hook_menu, I suppose I need to do something with wildcards, but I've never worked with those in menus so I'm not sure.
I would like to be able to use the menus as a source for primary and secondary menus in different themes, so I'm flexible with changing the site appearance by selecting another theme. I'm using Drupal 7.