CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Using CiviGroup Roles Sync
Pages: [1]

Author Topic: Using CiviGroup Roles Sync  (Read 2470 times)

midloman

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 1
Using CiviGroup Roles Sync
April 01, 2010, 03:18:43 pm
I've done experimentation with this module, and here is what I've  found:

You have a Drupal role you want to associate with a Civicrm group.
For the sake of illustration, use role Drupalmember, and group Civigroup

Assume you have created the association at admin/settings/civicrm_group_roles (required).
Assume that you have Drupal users with Drupalmember set on, but are not members of Civigroup
Assume you have Civicrm contacts who are members of Civigroup and are also Drupal users,
   but Drupalmember is not set on.

This can happen if you've used these roles and groups before activating Civigroup Roles Sync.

  • You edit or create a user from the drupal side, and set Drupalmember on.  This user joins Civigroup the next time they log in.
  • You remove a user from Drupalmember.  This does not remove them from Civigroup, and Drupalmember is turned back on when they log in.

For some reason, importing group members from a CSV file does not update the drupal side.
To remove a user from both lists, remove them from the group on the civicrm side - updates on login.

To force the immediate sync, select all members of Civigroup and add them to Civigroup.
I know this seems weird, but it updates Drupalmember immediately.

You can clear Drupalmember the same way (by removing all members of Civigroup from Civigroup).
You can use a tag to remember the members of Civigroup before removing them from the group.


Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using CiviGroup Roles Sync
April 01, 2010, 08:38:41 pm

thanx for the detailed notes. would be great if you could investigate and potentially fix the bug, so when someone is remove from the drupalmember role they also get removed from civigroup

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

midloman

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 1
Re: Using CiviGroup Roles Sync
April 02, 2010, 09:15:57 am
That's not a bug, it's in the notes as a todo.  I think it may far exceed my php skills to fix it.  I'm at the "insert a display statement and see what happens" level of coding.

I think the more serious issue is why import members from CSV and add to a group does not behave the same way as add/remove from group in the search for contacts section does.

I have not hunted it down in the code, but it looks like hook_civicrm_post() is never called in the import csv version.
So, we need the drupal role set from the csv import into Civicrm groups. For some reason, this ends up being a two-step process - one to add members to the group, and one to add the group to itself.

I also need some serious coding help to separate the default behavior of two-way sync to allow a choice of what should be done.  In my organization, chapter membership is determined elsewhere and must not be changed on the local level.  We have member-only areas on the website that can only be manipulated at the local level.  It would be nice to turn off the sync at login/edit time (I think).

Jim

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using CiviGroup Roles Sync
April 02, 2010, 09:43:16 am

Cool, if you do end up making those changes and/or tracking and fixing the import bug, please submit your changes back so others can benefit

i took a quick look at the import code and it does seem to fire the hook.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

midloman

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 1
Re: Using CiviGroup Roles Sync
April 02, 2010, 11:43:57 am
Updates to the Sync procedure that may be helpful:

You might not be able to copy a group to itself reliably - I got a WSOD when I tried it today.  Dedupe may have broken the procedure I described earlier.

Here is an alternative procedure to force the sync:

decouple the Civi group you want to have synced in the civigroup roles sync module.
create a new temporary group, couple this temporary group to the role you want to force.
copy all members of the desired group to the temporary group.  This forces the update in drupal users.
decouple and delete the temporary group.
recouple the desired group to the role.

Jim

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: Using CiviGroup Roles Sync
May 14, 2010, 11:20:06 am
just an FYI

this patch should fix the issue

http://issues.civicrm.org/jira/browse/CRM-6246
http://www.rootyhollow.com

TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Re: Using CiviGroup Roles Sync
May 15, 2010, 10:56:33 am
That patch is great.  Would be even better if it applied the same effect when removing roles at /admin/user/user.  I think these are the only two standard Drupal locations where roles are changed.  (Although some modules may be changing user roles, too, and I'm not sure how we'd trap that....)

Question: If I create a patch for this, should I add it to the closed issue or create a new issue?



Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using CiviGroup Roles Sync
May 15, 2010, 11:23:46 am

please create a new issue create a patch with regard to the new file in 3.2

i applied the patch to the 3.2 branch yesterday or so

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Using CiviGroup Roles Sync

This forum was archived on 2017-11-26.