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:
<?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');
}
}
<?php
namespace Piwik\Plugins\ZZHideMenus;
use Matomo\Menu\MenuAdmin;
use Piwik\Piwik;
/**
* Hides WooCommerce (Websites section) and API (Platform section)
* for every user that is **not** a Super User.
*/
class Menu extends \Piwik\Plugin\Menu
{
public function configureAdminMenu(MenuAdmin $menu): void
{
// keep the full UI for Super Users
if (Piwik::hasUserSuperUserAccess()) {
return;
}
/* ------------------------------------------------------------------
* 1. Websites → WooCommerce
* parent token : SitesManager_Sites
* child token : WooCommerce
* ------------------------------------------------------------------ */
$menu->remove('SitesManager_Sites', 'WooCommerce');
/* ------------------------------------------------------------------
* 2. Platform → API
* parent token : CorePluginsAdmin_MenuPlatform
* child token : General_API
* ------------------------------------------------------------------ */
$menu->remove('CorePluginsAdmin_MenuPlatform', 'General_API');
}
}
Another update, so to remove the WooCommerce from the menu, I had to go inside the plugin itself, I opened the menu.php which contains this:
<?php
/**
* Copyright (C) InnoCraft Ltd - All rights reserved.
*
* NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd.
* The intellectual and technical concepts contained herein are protected by trade secret or copyright law.
* Redistribution of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from InnoCraft Ltd.
*
* You shall use this code only in accordance with the license agreement obtained from InnoCraft Ltd.
*
* @link https://www.innocraft.com/
* @license For license details see https://www.innocraft.com/license
*/
namespace Piwik\Plugins\WooCommerceAnalytics;
use Piwik\Menu\MenuAdmin;
use Piwik\Piwik;
class Menu extends \Piwik\Plugin\Menu
{
public function configureAdminMenu(MenuAdmin $menu)
{
if (Piwik::isUserHasSomeAdminAccess()) {
$menu->addMeasurableItem('WooCommerce', $this->urlForAction('install'));
}
}
}
I changed this line:
if (Piwik::isUserHasSomeAdminAccess())
to this line:
if (Piwik::hasUserSuperUserAccess())
And this has fixed it finally after 24 hours spent on this.
Hopefully someone will find this useful.
Last step is to remove the newsletter signup which is located under Personal → Settings: