matomo-org / matomo-org/matomo-for-wordpress

Admin menu capability does not exist and generates an error with Freesoul Deactivate plugin

Open
#696 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
145
Forks
35
Avg merge
2d 2h
Merged PRs (30d)
6

Description

As per this forum post: Admin menu capability
Customer states:

”At line 48 of the file classes/WpMatomo/Admin/Menu.php you define const CAP_NOT_EXISTS = ‘unknownfoobar’;
Please, check this file:
https://plugins.trac.wordpress.org/browser/matomo/tags/4.12.0/classes/WpMatomo/Admin/Menu.php#L48

Then at line 77 of the same file, you add an admin menu page using the capability “unknownfoobar”:
This is your code:

add_menu_page( 'Matomo Analytics', 'Matomo Analytics', self::CAP_NOT_EXISTS, 'matomo', null, 'dashicons-analytics' );

It looks like nowhere in your plugin you add the capability “unknownfoobar”. At least, I don’t see it anywhere.
Can I ask you why you are adding an admin menu item with a capability that doesn’t exist?

I opened this thread because your plugin generates a conflict with Freesoul Deactivate Plugins. With FDP you can selectively disable plugins, and it rebuilds the admin menu in the backend. But becausee the logged user hasn’t the capability “unknownfoobar”, the admin menu item added by your plugin is missing when FDP is active.”

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read classes/WpMatomo/Admin/Menu.php around lines 48 and 77, then review the linked forum report and the interaction with Freesoul Deactivate Plugins. Done means the Matomo admin menu behaves correctly when the plugin rebuilds the backend menu, while retaining the intended access restrictions.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
authorization, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.