Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
d4mation opened this issue Nov 23, 2022 · 0 comments
Open

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

d4mation opened this issue Nov 23, 2022 · 0 comments

Comments

@d4mation
Copy link
Member

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' ),
);
}
}

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

No branches or pull requests

1 participant