Skip to content

Separate Capabilities for each Client Dash Menu/Submenu Page #206

Description

@d4mation

In the event that a User wants to have a User Role that is basically Administrator but without the ability to access Client Dash stuff, this will allow them to clone the Administrator Role but remove the Client Dash-related Capabilities.

Currently only the Client Dash Settings page has its own Capability. The others all use manage_options.

/**
* Adds the sub-menu item to the toolbar.
*
* @since 2.0.0
* @access private
*/
function add_pages() {
global $submenu;
add_menu_page(
__( 'Client Dash', 'client-dash' ),
__( 'Client Dash', 'client-dash' ),
'manage_options',
'clientdash',
null,
'dashicons-admin-generic',
100
);
add_submenu_page(
'clientdash',
__( 'Admin Page', 'client-dash' ),
__( 'Admin Page', 'client-dash' ),
'manage_options',
'clientdash_admin_page',
array( __CLASS__, 'load_admin_page' )
);
add_submenu_page(
'clientdash',
__( 'Helper Pages', 'client-dash' ),
__( 'Helper Pages', 'client-dash' ),
'manage_options',
'clientdash_helper_pages',
array( __CLASS__, 'load_helper_pages' )
);
add_submenu_page(
'clientdash',
__( 'Settings', 'client-dash' ),
__( 'Settings', 'client-dash' ),
'manage_options',
'clientdash_settings',
array( __CLASS__, 'load_settings' )
);
add_submenu_page(
'clientdash',
__( 'Addons', 'client-dash' ),
__( 'Addons', 'client-dash' ),
'manage_options',
'clientdash_addons',
array( __CLASS__, 'load_addons' )
);
if ( current_user_can( 'manage_options' ) ) {
$submenu['clientdash'][0] = array(
__( 'Customize Admin', 'client-dash' ),
'customize_admin',
site_url( '/?clientdash_customize=1' ),
);
}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions