Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anonymous-matomo-user opened this issue Sep 8, 2009 · 5 comments
Closed
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@anonymous-matomo-user
Copy link

Hello,

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.
@robocoder
Copy link
Contributor

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.

@mattab
Copy link
Member

mattab commented Sep 8, 2009

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)

@anonymous-matomo-user
Copy link
Author

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

@mattab
Copy link
Member

mattab commented May 1, 2010

This was implemented in Admin menus recently, see the function and code in: https://github.com/piwik/piwik/blob/master/core/PluginsFunctions/AdminMenu.php#L105

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

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

@mattab
Copy link
Member

mattab commented Jul 7, 2010

This was fixed in #1403

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 0.8 - A Web Analytics platform milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

3 participants