2

I'm using drupal 7 with CiviCRM 4.4.6.

I'm using CiviMember Roles Sync with below Association Rules:

Rule ID: 3
"CiviMember Membership Type" --> "Drupal Role": Member (PG) --> member
Current Codes: New, Current
Expired Codes: Grace, Expired, Pending, Cancelled, Deceased

Rule ID: 4
"CiviMember Membership Type" --> "Drupal Role": Member (KK) --> member
Current Codes: New, Current
Expired Codes: Grace, Expired, Pending, Cancelled, Deceased

In setting "Automatic Synchronization Method", I select "Synchronize whenever a user logs in or logs out."

When user login, error appear as below:

Notice: Undefined index: 4 in _civicrm_member_roles_sync() (line 541 of /home/warrior/www/beta/sites/all/modules/civicrm/drupal/modules/civicrm_member_roles/civicrm_member_roles.module).

Here are drupal user roles available on my site:

ID 3: Web Developer
ID 4: Content & Membership
ID 5: member
ID 6: Membership Admin

I tried to change "Automatic Synchronization Method", but the error still appears.
When I change to "Synchronize when membership is updated", error appears after payment made (membership updated).
When I change to "Synchronize when Drupal cron is ran", error appears when I run cron.

Any idea how to solve this error?

2

What you've found is that the error appears whenever your sync runsTwo things:

  1. This is a PHP notice, which is a very low-importance message to receive. Nothing is breaking; this is just something to say that something mildly improper is going on in the code. Notices like this are actually something you should suppress on a production site: in the Drupal menu, go to Configuration, then under Development click Logging and Errors. Select none under Error messages to display. That will make the error quit appearing on screen, but it will still probably appear in your log, so it's worth getting to the bottom of it.
  2. It does reflect an actual bug (albeit small) in CiviCRM's code. Basically, this line of code asks whether the item in the $memberroles array for a contact's membership's membership type is an array. Well, it's possible that the $memberroles array doesn't have an item for that membership type: it's only populated with the membership types for which you've got sync rules set up. Apparently, in your case, at least someone has a membership of a type that doesn't sync with a Drupal role. This is normal and okay; the code just doesn't consider this situation.

Apparently, the problem still exists in the development version of the code. Please log in at issues.civicrm.org and log an issue for this. The fix will take no time, but it's good to have a record of the bug there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.