Plugins hook to control the order of entries in the menu #973

anonymous-piwik-user opened this Issue Sep 8, 2009 · 5 comments

3 participants



Is it possible to hide or change the position for the main menu.
I write a plugin, and I want it to show in the first menu. And the default menu is my plugin, not dashboard.

In plugin manger, I can only desactive the plugin, and there is no way to hide the menu.

Some ideas for this feature:
1. add hooks like this

  • "Piwik_Menu.remove" : hide the menu
    -"Piwik_Menu.move" : change the position of menu
    -"Piwik_Menu.default":set the default menu to show when we visit piwik/index.php
    With these hooks, we can write a plugin to achieve this feature.

  1. In "Settings"->"plugins",add some options for this feature.

Advanced feature:
1. Administrators can show different menu for different user.

  • With hooks, developers can write a plugin to achieve this feature. But I think it will be better to add it in 'settings'.
  1. Visitors can directly move or remove the menu in UI.

I don't think hooks should be used to change the behaviour of other plugins. Once #24 is done, it should be possible for plugins to provide this level of configurability.

In the meantime, please look at core/PluginsFunctions/Menu.php. You might be able to use Piwik_RenameMenuEntry() and Piwik_EditMenuUrl(). If you need more functionality here, submit a patch for your use case.

Piwik Open Source Analytics member

One change might be to have the menu based on priorities to decide the order.

For example, dashboard would be priority 10, Actions = 20, Referers = 30, etc.
Then a method would allow to change priority of a given menu entry.

Any new menu added could put itself first (by setting any priority < 10), or in the middle of any other menu entry (for example, priority = 15 would put it after dashboard before Actions)


I think hide some menus is also necessary. Sometimes we don't want to show some menu but we want it be actived.

Piwik Open Source Analytics member

This was implemented in Admin menus recently, see the function and code in:

function Piwik_AddAdminMenu( $adminMenuName, $url, $displayedForCurrentUser = true, $order = 10 )

This could be done for the normal menu, and top bar menu too.

Piwik Open Source Analytics member

This was fixed in #1403

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment