Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-6938

small clean-up for civicrm_group_roles.module

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2.3
    • Fix Version/s: 3.3.alpha
    • Labels:
      None

      Description

      We did some work to try and integrate the civicrm_group_roles module with a call to user_save that was removing roles. We quickly found ourselves in and endless loop between user_save and hook_civicrm_post ( civicrm_group_roles_civicrm_post ) when we added an expression for $op= 'update'. we had to add the code at $op = 'update' because that is the only point in editing a contact when the $user['roles'] and $edit['roles'] array passed to user_save are different.

      Consequently, we simply added the civicrm_group_roles_add_remove_groups function which can be called immediately after the user_save call with many of the same parameters, it's not ideal but it's better than forcing Drupal coders to sort through 4 API calls, etc...

      the patch is against trunck but will apply against 3.3 also.

      Also, replaced array_diff with array_diff_key as you cannot reliably depend on the value in the elements of $user->roles as you can the key

        Attachments

          Activity

            People

            • Assignee:
              sushant Sushant Paste
              Reporter:
              jalama Jim Taylor
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: