How to use WP Roles with B2BKing

Table of Contents

By default B2BKing does not use WP roles (such as 'customer', 'editor', etc). Instead, the plugin uses its own groups to organize customers - we prefer this approach as it results in fewer conflicts.

However, for compatibility with other plugins that use roles, you may want B2BKing to also sync its groups with a WP role.

How to enable WP Roles Sync #

You can achieve this in 3 steps:

(1) Install a plugin that adds support for multiple roles. For example you can use:

Members or HM Multiple Roles

(2) Add the following PHP code snippet to your site:

add_filter('b2bking_use_wp_roles','__return_true');

(3) Now deactivate, and reactivate the B2BKing Pro plugin.

That's it. You will now find the plugin has created a WP Role for each B2BKing Group. From now on, the plugin will try to constantly sync groups and roles automatically, whenever a user is created, saved, etc.

However, for existing users, you may need to manually sync the role initially. One quick way to do this is to simply save users in the backend - this will also sync the group and role.

Powered by BetterDocs