• Resolved dhughes01

    (@dhughes01)


    In the client-dash.php file, whether or not a message to update “Display Settings” (due to role modifications) is determined by whether the user has manage_options capability. Can this be modified so that it’s determined by whether the user has both manage_options and activate_plugins capability?

    In my case, I’ve created a custom role (which I’ve called site_admin) who can access some admin level settings (for example, they can see custom plugin menu items), but I don’t want them to be able to change the Client Dash settings (or else they could override the hidden menu items). But because they have manage_options capability, they see an error message they’re unable to fix (since they don’t have the activate_plugins capability needed to be able to change the display settings)

    I could technically change it on my end, but I’d be breaking a primary rule of plugin modifications – try not to modify a plugin directly because the changes will be lost when the next update is released.

    Thanks so much for your time and have a great afternoon!

    https://ww.wp.xz.cn/plugins/client-dash/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor joelworsham

    (@joelworsham)

    Ah, yes. There is no good way to change this message currently, but I can guarantee you this message will no longer be present in future versions of Client Dash.

    For now, there is a workaround, albeit a little weird.

    Place this code either in your themes functions.php file, or in a standalone plugin:

    add_filter( 'pre_option_cd_existing_roles', function ( $false ) {
    	if ( ! current_user_can( 'activate_plugins' ) ) {
    		return get_editable_roles();
    	} else {
    		return false;
    	}
    } );

    This will short circuit the message entirely for now for any user that does NOT have the activate_plugins capability, which you mentioned is whom you want to NOT see the message.

    Plugin Contributor joelworsham

    (@joelworsham)

    Can I help you any more with this issue?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Role Modification Admin Notice Problem’ is closed to new replies.