How to allow different WordPress roles to use the features of Organization Toolkit

Estimated reading: 3 minutes 205 views

By default, only the WordPress admin role has access to set up and manage Organization Toolkit. If you want to allow other roles to be able to use the features, you will need to give these roles the capability to do so. There are 2 ways to do this:

Using a plugin

In this video we will use the User Role Editor to give WordPress’ “Editor” role access to the features of Organization Toolkit.

 


By adding code to a theme or plugin

The code below shows an example of how you can give the editor role access to all of Organization Toolkit’s features:

				
					function mytheme_setup_custom_roles() {

    $editor_role = get_role( 'editor' );
    $editor_role->add_cap( 'b2bdash_import_users' );

    $editor_role->add_cap( 'b2bdash_manage_organisations' );
    $editor_role->add_cap( 'edit_b2borganisation' );
    $editor_role->add_cap( 'edit_others_b2borganisation' );
    $editor_role->add_cap( 'publish_b2borganisation' );
    $editor_role->add_cap( 'read_b2borganisation' );
    $editor_role->add_cap( 'read_private_b2borganisation' );
    $editor_role->add_cap( 'delete_b2borganisation' );
    $editor_role->add_cap( 'edit_published_b2borganisation' );
    $editor_role->add_cap( 'delete_others_b2borganisation' );
    $editor_role->add_cap( 'delete_published_b2borganisation' );
    $editor_role->add_cap( 'edit_b2borganisations' );
    $editor_role->add_cap( 'edit_others_b2borganisations' );
    $editor_role->add_cap( 'publish_b2borganisations' );
    $editor_role->add_cap( 'read_b2borganisations' );
    $editor_role->add_cap( 'read_private_b2borganisations' );
    $editor_role->add_cap( 'delete_b2borganisations' );
    $editor_role->add_cap( 'edit_published_b2borganisations' );
    $editor_role->add_cap( 'delete_others_b2borganisations' );
    $editor_role->add_cap( 'delete_published_b2borganisations' );

    $editor_role->add_cap('b2bdash_manage_registration_forms');
    $editor_role->add_cap( 'edit_b2bregform' );
    $editor_role->add_cap( 'edit_others_b2bregform' );
    $editor_role->add_cap( 'publish_b2bregform' );
    $editor_role->add_cap( 'read_b2bregform' );
    $editor_role->add_cap( 'read_private_b2bregform' );
    $editor_role->add_cap( 'delete_b2bregform' );
    $editor_role->add_cap( 'edit_published_b2bregform' );
    $editor_role->add_cap( 'delete_others_b2bregform' );
    $editor_role->add_cap( 'delete_published_b2bregform' );
    $editor_role->add_cap( 'edit_b2bregforms' );
    $editor_role->add_cap( 'edit_others_b2bregforms' );
    $editor_role->add_cap( 'publish_b2bregforms' );
    $editor_role->add_cap( 'read_b2bregforms' );
    $editor_role->add_cap( 'read_private_b2bregforms' );
    $editor_role->add_cap( 'delete_b2bregforms' );
    $editor_role->add_cap( 'edit_published_b2bregforms' );
    $editor_role->add_cap( 'delete_others_b2bregforms' );
    $editor_role->add_cap( 'delete_published_b2bregforms' );

    $editor_role->add_cap( 'b2bdash_export_troubleshooting' );

}

add_action('admin_init','mytheme_setup_custom_roles');				
			

Leave a Comment

Share this Doc

How to allow different WordPress roles to use the features of Organization Toolkit

Or copy link

CONTENTS