WP Statistics access for other roles

Administrator only has access to the WP Statistics WordPress plugin by default. Is it possible to allow WP Statistics access for other roles? For the testing purpose we will give access to the “Statistics” menu of WP statistics plugin to the user with “Editor” role.
“Administrator menu access” additional module to the User Role Editor Pro will help you to resolve this task.

1st, you need to activate “Administrator menu access” add-on. Go to the “Additional modules” tab of User Role Editor Pro Settings and turn on correspondent checkbox.

Activate administrator menu access module
Activate administrator menu access module

When you need to know what capability uses some plugin for its own menu or menu item, check it at menu for Administrator role. Administrator has full access by default and you will find any menu item there. So 1) open User Role Editor, 2) select “Administrator” role and 3) open “Administrator menu” window:

Check admin menu for administrator role
Check admin menu for administrator role

Scroll opened list of menu items to the “Statistics” one and look that this menu, including all underlying menu items is prohibited by “manage_options” user capability.

Find user capability for Statistics menu
Find user capability for Statistics menu

Thus, in order user with “Editor” role has access to the “Statistics” menu you need to add “manage_options” capability to the “Editor” role.
1) Select role “Editor”,
2) Turn on “manage_options” capability and
3) Click “Update” button.
Done. “Editor” role has access to the “Statistics” menu now. But it is only part of a problem. User with “manage_options” capability automatically gets access to the “Settings” menu, which you don’t plan I suppose. So you need to block access to any other menu items, which use “manage_options” capability for its protection.
4) Click “Admin menu” button to manage what admin menu items are available for the “Editor” role.

Give editor role access to Statistics menu
Give editor role access to Statistics menu

Turn on checkboxes for menu items you wish to block for the “Editor” role. At the screenshot below we blocked access to the “Settings” menu and all underlying menu items.

Block editor role access to Settings menu
Block editor role access to Settings menu

Let’s see what admin menu looks like for the user with “Editor” role after changes made:

Check access of user with editor role to Statistics menu - 1
Check access of user with editor role to Statistics menu – 1

It works, right?

Check access of user with editor role to Statistics menu - 2
Check access of user with editor role to Statistics menu – 2

User with “Editor” role got access to the “Statistics” menu. But he has no access to the “Settings” menu.

Pay attention that with current model of blocking access to the admin menu items it is needed re-check your admin menu settings for every role after new plugin installation. If new plugin adds own menu protected with “manage_options” capability, it will become available for the “Editor” (or other role you modified) until you block that menu directly.

Share