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) »
  • CiviGroup Roles Sync not working
Pages: [1]

Author Topic: CiviGroup Roles Sync not working  (Read 1131 times)

groston

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 0
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.34
  • PHP version: 5.3.27
CiviGroup Roles Sync not working
June 25, 2014, 07:29:15 pm
CiviGroup Roles Sync is not working for me. I have been trying manual synchronization to make sure that it is functioning properly. When I do this, the following error appears in the Drupal log:

Notice: Undefined index: processed in civicrm_group_roles_batch_worker() (line 750 of /home/neftempo/public_html/sites/all/modules/civicrm/drupal/modules/civicrm_group_roles/civicrm_group_roles.module).

Based on articles posted here and elsewhere, I have tried/checked the following:
  • Clear drupal caches
  • Confirmed that rule exists: Primary Contacts <--> Primary Contact
  • Confirmed database entry: dr_civicrm_group_roles_rules {1, 9, 10}
  • Confirmed that Drupal role exists: dr_roles {9, Primary Contact, 8}
  • Confirmed that CiviCRM group exists: civicrm_group {10, Primary_Contacts_10, Primary Contacts, ...}
  • COnfirmed that all contacts in CiviGroup Primary Contacts exist as Drupal users.
  • Applied fix in http://forum.civicrm.org/index.php/topic,29404.msg135066.html#msg135066 - does not address the current problem

The problematic line is from the following routine, with the specified line flagged:

function civicrm_group_roles_batch_worker($uid, &$context) {
  if ( ! civicrm_initialize( ) ) {
    return;
  }
  $account = user_load($uid);

  $roles = array_diff_key( $account->roles, array( 1 => 'anonymous user', 2 => 'authenticated user' ) );

  if ( $roles ) {
    civicrm_group_roles_add_remove_groups ( $roles, $account, 'add' );
  }

  $context['results']['processed']++;   **** this line of code ****
  $context['message'] = 'Successfully synchronized ' . $context['results']['processed'] . ' users';
}

I am not a php programmer, but... This looks like a string is being used as an array key, which I gather is kosher in php. I do not know from whence this function is being called (I searched the entire directory tree and could not find the call), so I was unable to figure out why the array context is missing the index processed.

Please help me figure this out.

jsimonis

  • I post frequently
  • ***
  • Posts: 316
  • Karma: 4
    • Forward Support, Inc.
  • CiviCRM version: 4.4-4.5
  • CMS version: Drupal 7
  • MySQL version: 5.5.37-cll
  • PHP version: 5.3.29
Re: CiviGroup Roles Sync not working
September 21, 2014, 11:36:13 pm
I've run into the same issue. I get that error and my sync is not running. I'm using CiviCRM 4.4.6

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: CiviGroup Roles Sync not working
September 29, 2014, 06:57:58 am
I've just tested this on a CiviCRM 4.4.6 site using Drupal 7.31, and I can confirm that the manual synchronisation does not work for me.

However, testing it on a user account (i.e. change their Civi group membership to one that will trigger a role change), the log in as that user, and the sync on login does work.
Graham Mitchell
http://mc3.coop

jsimonis

  • I post frequently
  • ***
  • Posts: 316
  • Karma: 4
    • Forward Support, Inc.
  • CiviCRM version: 4.4-4.5
  • CMS version: Drupal 7
  • MySQL version: 5.5.37-cll
  • PHP version: 5.3.29
Re: CiviGroup Roles Sync not working
September 29, 2014, 07:41:57 pm
Yea, that sync is working for me. It's just the manual one that won't work.
What I did was tell the client that the system does the sync when a person logs in (and checks every time they log in to see if their status is still valid). They were fine with that. But it's nice to be able to do the manual sync, especially when you're first starting out and have imported a bunch of people and membership.

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: CiviGroup Roles Sync not working
September 30, 2014, 12:57:35 am
Just tested the manual sync in Civi 4.5 on Drupal 7.31 and it works. A good incentive to upgrade.
Also, it's possible that the Drupal module may work with an earlier version of Civi - although I've not tested that - if upgrading to 4.5 is not currently feasible for you.
Graham Mitchell
http://mc3.coop

jsimonis

  • I post frequently
  • ***
  • Posts: 316
  • Karma: 4
    • Forward Support, Inc.
  • CiviCRM version: 4.4-4.5
  • CMS version: Drupal 7
  • MySQL version: 5.5.37-cll
  • PHP version: 5.3.29
Re: CiviGroup Roles Sync not working
October 07, 2014, 12:12:18 am
Thanks. We just underwent a huge upgrade process to get to where we were because of a mess left by previous developers. I'll probably wait until registration is over for the upcoming conference before I do the next upgrade. Don't want to take down the site or cause any issues during registration. This appears to be the second fix/improvement that I've run into that I need in 4.5, so we'll definitely upgrade at some point soon.

groston

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 0
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.34
  • PHP version: 5.3.27
Re: CiviGroup Roles Sync not working
October 07, 2014, 04:36:31 pm
Manual sync with CiviCRM 4.4.6 and Drupal 7.31 seems to work fine for me.

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: CiviGroup Roles Sync not working
October 08, 2014, 12:16:20 am
Curious. It would be great to get a definitive opinion on this. I imagine that many people rely on this module for really important functionality on their site, and at the same time the documentation seems to pretty minimal, I'm unclear about whether it is being maintained by the core team or is considered a community contribution. Could benefit from some TLC.
Graham Mitchell
http://mc3.coop

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: CiviGroup Roles Sync not working
October 08, 2014, 08:58:57 am

The community has been maintaining this module for some time (similar to the views module and other modules). We just merge in the PR's submitted by folks

Would be good for people to start adding test cases to ensure that functionality keeps working in future releases so we know if/when a PR breaks things

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

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: CiviGroup Roles Sync not working
October 08, 2014, 12:33:01 pm
Thanks for the clarification Lobo.
Graham Mitchell
http://mc3.coop

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

This forum was archived on 2017-11-26.