Documentation - Actions / Filters - Filter – Add Custom Role / Modify exiting – Minimum capability to use this plugin

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPrint this page

Filter – Add Custom Role / Modify exiting – Minimum capability to use this plugin

This filter can be used to add a Custom Role or to Modify existing role capability. The minimum capability setting is used to show the re-order interface to certain roles.

apto_get_roles_capability

Examples

The following code will add a custom role also modify the Subscriber role capability to something else:

add_filter('apto/get_roles_capability', 'theme_apto_get_roles_capability');
function theme_apto_get_roles_capability($roles_capability)
    {
        //add a custom role 
        $roles_capability['Custom Role'] = array(
                                        'title'         =>  __('Custom Role', '_my_localize_prefix_'),
                                        'capability'    =>  'read');
        
	//modify the custom capability
        $roles_capability['Subscriber']['capability']   =  'custom_capability';
            
        return $roles_capability;
    }

*This code should be used within a theme or a custom plugin.