Roles Synchronization
Last updated
Last updated
You can set up synchronization of WordPress user roles with Discord member roles. To do this first you need to assign bindings of roles pairs. Go to the WordPress admin panel and to Settings
--> Discord
and open Roles Sync
tab you will find the interface of bonding.
A left selector is the WordPress role and the right one is the Discord role. If you do not see all Discord roles in the selector try to update roles data in the Data Update Intervals
section, also if the role is already bonded it will not appear in the selector. The arrow shows the direction of synchronization. If the arrow points from WordPress to Discord then during syncing Discord roles will be changed accordingly to WordPress. If it points from Discord to WordPress then WordPress roles will be changed accordingly to Discord. To switch the direction of the syncing click Reverse
button beneath the arrow.
For example, if you syncing 2 roles from WP to Discord and the user has only one WP role then the existing role will be assigned, and absent will be removed from Discord. During synchronization, not bonded roles from both sides will be ignored.
WordPress is keeping multiple assigned roles but displaying only the highest one.
Be very careful with bonding pairs. As an administrator, you can assign any combinations, for example, you can bind administrator WordPress role with some common role on Discord, and all WP users will get or lose the administrator role depending on the sync direction. These actions are not reversible and you will have to restore website backup to undo it!
If you synchronizing roles from WP to Discord make sure that the roles you are trying to assign are positioned beneath the Bot role. To do this go to the Discord app and open guild settings. On the Roles page, you can find a list of existing roles, rearrange them - put bot role on top of all assignable roles.
Another example is roles looping. You can make a loop by simply assigning and then deleting the same role. Or with a more complex example like in the image below. Because by default WP activating only the last assigned role during first syncing you will assign Discord Role 1 and Contributor but during the second sync Discord Role 1 will not be assigned because WP role already will be Contributor.
Roles synchronization will work only with WordPress profiles with connected Discord profile.
You can start the synchronization of all users right now by clicking Synchronize All Roles
button. By default roles of all users are scheduled for synchronization every 4 days. Also, the particular user will be synchronized on registration or authorization via Discord profile, and role change on the website.
When syncing executing during the manual change in the user profile or by change from other plugins syncing will be only in one direction - from WP to Discord. It is important to skip syncing from Discord to WP at such moments because it may create unexpected loops in other plugins. So if in your settings you have a setup that is changing WP role back it will happen during the next full syncing. This way you also can create loops.