Synchronize CiviCRM groups with Drupal roles¶
The CiviGroup Roles Sync module lets administrators of Drupal Websites:
- Allow board members, committees, staff, and volunteers to access specific content or perform specific tasks.
- Provide customized experiences for users of specific groups when they access the website. For example, when a major donor logs in, the website could display a letter from the President thanking the donor for his contribution and participation, or provide major donors with pre-registration access to upcoming events and exclusive news or resources.
Assess how different users interact with your website. Consider whether their experience depends on organized groups, teams, committees, or task forces; whether a contact meets specific criteria; or whether you should apply roles manually.
In essence, the module synchronizes Drupal users who have a certain role with CiviCRM contacts in a certain group.
Preparation¶
Before using CiviGroup Roles Sync module, prepare the following:
- Create your organization’s Groups.
- Create the roles needed for each use case in Drupal.
- If you use additional modules to fine-tune access, install and configure all the modules you need.
When determining what Groups and what Drupal Roles you should create, remember that multiple Group Types may grant the same Drupal Role and each Group can be used to grant multiple Drupal roles.
Enable the module from the Drupal module administration screen.
Syncing CiviCRM groups to Drupal roles¶
- Navigate to the CiviGroup Role Sync configuration screen.
- Click Add Association Rule.
- Under CiviCRM Group, select the Group that you want a user to have in order to be granted a specific Drupal Role.
- Under Drupal Role, select the Drupal Role that should be granted.
- Click Add Association Rule when you have finished configuring the new association rule.
You can edit or delete existing association rules from the same configuration screen.
The next time a user whose contact is in the CiviCRM group logs in, they will be granted the role associated with the group. If you remove them from the group, the role will be removed the next time they log in.
Note
Unlike CiviMember Role Sync, which has configureable options for when synchronization happens, CiviGroup Role Sync only synchronizes on user login. If you have really long cookies on your site and don’t close users sessions, a user could stay logged in and continue to have a role in Drupal even after you have removed the user from the associate group in CiviCRM.