Setting user's Available Default Dates

Well, because of performance issues (we have a big amount of data into piwik database), we would like to avoid users setting their default to custom ranges into userSettings module.

I’m diving int UsersManager Plugin, userSettings action, I’ve discovered getAvailableDefaultDates(). The problem is a protected function.
My idea would be writing a plugin hooking to controller.action APIs (UsersManager.userSettings) removing ranged values from the array but I have no idea how to hook into it. Any advice is welcome.

     * Returns the enabled dates that users can select,
     * in their User Settings page "Report date to load by default"
     * @throws
     * @return array
    protected function getAvailableDefaultDates()

Thanks for the request, I created and fixed ticket: Let plugin developers customise the list of "Report date to load by default" · Issue #5153 · matomo-org/matomo · GitHub

Thank you for fixing so speedy! I was able to publish our first free software plugin RerUserDates. Any feedback is welcome. X(

I’ve followed Piwik’s developer guide about plugins distribution by marketplace but I can’t find in it. What’s wrong? Is there any moderation on marketplace population?

Nice one. It is published:

(there is no moderation in Piwik marketplace)

Well… I got some trouble during first commit, because I’ve tagged the branch before committing the code.
I felt is not very clear in the guide but it’s a minor issue. Maybe I’m only wrong.
Thank you for your helpfulness!

Hi @tassoman, thank you for giving this plugin to the community.

I have installed and found that the settings only take effect if you login and not when using the API to widgetize the entire dashboard.

@matthieu, should plug-ins only take effect in the UI (after login) or also when called via an API method?

I’m not looking to call out an error, just understand if I am expecting something to happen and this is not possible in the way that Matomo works.

I want to hide the custom date range for a user, when widgetizing their full dashboard as I don’t want this user to login.

Thanks all.


Ciao Louis,
thank you so much for being a power user of our community contributed plugin.

As you discovered, there’s no modification of APIs core, that plugin is limited to web GUI interface modifications.

We didn’t go further because of any usage of APIs outside the web GUI.
Anyone is welcomed to contribute by pushing pull requests on the Github.

Best regards, enjoy :sunny:

1 Like

Hey @tassoman. Thank you so much for responding and for the clarification.