WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. boyska
    Member
    Posted 2 years ago #

    Hello,
    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?

    http://wordpress.org/extend/plugins/user-role-editor/

  2. Vladimir Garagulya
    Member
    Plugin Author

    Posted 2 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

About this Topic