OK, this might be a bit specialized, but there was no way to get at the menu tree using core D7 alter hooks or any preprocessing hooks. We had a need to preprocess the raw menu tree before it is rendered (which is all you get in template_preprocess_menu_tree, not the structure tree like you would expect from the function name).
This small patch adds the following alter hooks to site_map that are called immediately before a menu tree is rendered:
- hook_site_map_menu_tree_alter(&$tree, $menu)
- hook_site_map_menu_tree_MID_alter(&$tree, $menu)
The menu ID is munged just like most machine name based callbacks, converting anything non-numeric, non-alpha, and not underscores to underscores (e.g. "main-menu" becomes "main_menu").
Patch attached below, hopefully someone else will have a use for it - and it might not be a bad feature to port to the module.