I have a plugin that offers certain bits of functionality. For most sites this should be restricted to only some users.
Currently, my plugin limits the functionality to administrators using:
Ideally I'd like to leave this as a default (It works for most people). However I'd really like to have a custom capability so that people can assign this to users (Or roles) that they want to be able to use the functionality.Code:if (current_user_can('manage_options')) {
I've read a few articles, but none of them really seem to explain this.
Currently, I'm thinking of using something like this:
So that the standard case works, but also people would be able to assign the capability 'do_my_plugin_stuff' to roles they want to be able to do stuff.Code:if (current_user_can('manage_options') || current_use_can('do_my_plugin_stuff') ) {
Is that it? Do I need to register the capability as well? How do people actually assign this capability - do they need to use something like the "Role Manager" plugin?


LinkBack URL
About LinkBacks
Reply With Quote