User Role Editor
Make plugin integrated with user role editor (2 posts)

  1. boyska
    Posted 4 years ago #

    I wrote a plugin (indypress) which makes use of "custom" permissions. Unfortunately, this is not so easy for the admin to use, because they have to manually add the permission to the table. It works, it's just not easy.

    I'd like to make it "checkable".
    It could be done by adding a apply_filter call on the list of capabilities, adding a new one.

    How can I do that?


  2. Vladimir Garagulya
    Plugin Author

    Posted 4 years ago #

    You can use this code to add new capability directly to WordPress roles object:

    global $wp_roles;
    if (class_exists('WP_Roles'))
    	if ( ! isset( $wp_roles ) )
    		$wp_roles = new WP_Roles();	
    if (is_object($wp_roles)) {
    $wp_roles->add_cap( 'administrator', 'user_can_something_new' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • User Role Editor
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic