Min Capabilities for User? | WordPress.org

[ad_1]

Looking at the code it looks like it’s checking for roles instead of capabilities. It’s checking for the ‘editor’ role which means that custom roles cannot be defined and used with the plugin.

In the function can_access_features(), please consider checking for a capability instead such as ‘edit_posts’?

Similar for administrator – instead of checking for the ‘administrator’ role in the can_access_settings() function, maybe check for something like ‘manage_options’ or the super admin capability (multisite)?

Thanks.

@elect2all, I asked a moderator to check if you are spamming or not. I don’t think it helps anyone and it also seems completely unrelated. It’s also your second message on this forum within a few minutes about this same service ). You are not supposed to do that.

Hi @nigel01! The can_access_features and can_access_settings are actually two functions I am using on all my plugins, in the same way, and it has been working really well like this. Each of them have a related filter (mwai_allow_setup and mwai_allow_usage). Why not overriding the behavior of those functions via those filters? You can basically control it completely the way you like. As a side note, I might change the name of those functions, but not the filters.

Hi @tigroumeow:

Yup, using the filters is exactly what I did to handle the issue I was trying to resolve. But unless someone digs into the code they wouldn’t know the filters exist. In that case they’ll be stuck with using WP built in roles instead of being able to define their own custom roles.

Seems a shame to not allow admins to be able to use the roles-and-capabilities system flexibly the way it was designed.

Happy to push a PR for it since I’m sure you’re busy – I just don’t know if there’s a public git repo somewhere.

Thanks.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer