Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.2.2, 3.2.3, 3.2.4
-
Fix Version/s: 3.3.beta
-
Component/s: Drupal Integration Modules
-
Labels:None
Description
Currently, the function _civicrm_member_roles_sync is structured such that when it finds a current membership that matches a role, it breaks from the loop through a contact's memberships and quits looking for further memberships. The function is also structured strangely: it loops through contacts, going through all of the rules for role sync for each contact, and through all of a contact's memberships for each rule. Organizations that have complex membership structures (e.g. places where people can be members of an association and/or its related foundation, with several membership types each) cause chaos here.
I've attached a patch that changes this function around. It queries the rules only once. For each contact, it gets the memberships, loops through them, and assembles arrays of roles to add and remove.