WP Statistics access for other roles

Administrator only has access to the WP Statistics WordPress plugin by default. Is it possible to allow access to WP Statistics 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 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.

admin menu access add-on activation
Admin menu access add-on activation

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

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

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

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 granting access to the “Statistics” menu is only part of a problem. Any user with “manage_options” capability automatically gets access to the items “Settings” menu and some other plugins. If you didn’t plan this, you need to block access to any other menu item, which uses “manage_options” capability for its protection.
4) Click “Admin menu” button to manage what admin menu items are available for the “Editor” role.

admin menu for editor role
Admin menu for editor role

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 submenu items.
block settings menu for editor role
Block Settings menu for editor role

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

admin menu for editor role
Admin menu for editor role

It works, right?
User with “Editor” role got access to the “Statistics” menu. But he does not have access to the “Settings” menu.

Pay attention that with current “Block Selected” 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