Quantcast
Channel: Support & Bugs - Matomo forums
Viewing all articles
Browse latest Browse all 5981

Matomo whitelabel - remove menu items for non-super users

$
0
0

So I have a client and I have prepared matomo, I have the white label plugin and what’s left is to remove 3 more elements. The elements are attached in the images below:

So basically I want to remove the newsletter signup which is under Personal → Settings

i want to remove woocommerce which is under websites and I want to remove API which is under platform.

Can anyone point me on where to find menu keys for matomo to remove these?

I found an answer here: How to code a plugin that hides menu items from non-superadmins_ - #2 by Lukas

And I have this: https://developer.matomo.org/guides/menus

I tried this solution:

<?php
namespace Piwik\Plugins\HideMenus;

use Matomo\Menu\MenuAdmin;
use Matomo\Menu\MenuTop;
use Piwik\Piwik;

class Menu extends \Matomo\Plugin\Menu
{
    public function configureAdminMenu(MenuAdmin $menu): void
    {
        if (Piwik::hasUserSuperUserAccess()) {
            return;
        }

        // Hide API under Platform
        $menu->remove('Platform_Platform', 'API');

        // Hide WooCommerce under Websites
        $menu->remove('Websites', 'WooCommerce');

        // Optionally hide Diagnostic if you want
        // $menu->remove('Diagnostic_Diagnostic', 'Diagnostic_Diagnostic');
    }

    public function configureTopMenu(MenuTop $menu): void
    {
        // You can remove top menu items if needed (e.g., Marketplace)
        // Example: $menu->remove('CorePluginsAdmin_MenuPlatform', 'Marketplace_Marketplace');
    }
}

But it doesn’t work.

Can anyone help please?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5981

Trending Articles