2

We are on 4.6.18 and Drupal. The code in CRM\Contact\BAO\GroupContactCache.php has updated since 4.6.17.

We have users joining our public site to get a Drupal username and a CiviCRM membership (having paid a contribution). They then have a link to view and update their profile. When new users click to view their profile, they see "Permission Denied You do not have permission to view this contact record. Contact the site administrator if you need assistance."

From looking at the code, this message appears if the contact is not in the profile's group. The CiviCRM profile does indeed Limit listing to a specific group, which is a smart group with contacts with the relevant membership types. Our smart group timeout is zero so it should update immediately. However this seems not now to be happening. If I "Cleanup Caches" then the contact is put in the group and it works fine.

I haven't got detailed evidence but it seemed like our smart group cache was never updating.

I could set the cache timeout and set up a scheduled task to rebuild the smart group cache. However this would not be ideal.

I haven't looked at GroupContactCache.php Has the above behaviour changed in recently? How can I fix this? Or any other suggestions on how to avoid this problem?

Thanks, Chris

  • At the moment, the smart groups aren't rebuilt even if I set up a scheduled task and give the cache a non-zero timeout. Help! – chriscant Jun 23 '16 at 21:05
  • Part of the problem is that the new GroupContactCache.php incorrectly uses Ymdhis instead of YmdHis twice near the end. However this doesn't solve my problem. I'll file a bug report for this in due course. – chriscant Jun 24 '16 at 15:20
1

With a timeout setting of 0 for the smart group cache, Civi was none-the-less working with a timeout of 5 minutes. When a contact is added, clearContactCaches() is called which does call CRM_Contact_BAO_GroupContactCache::remove(). However smart groups that have not timed out will not be cleared.

To fix my issue I added to clearContactCaches() a call to clear the specific group that might be used immediately, ie: CRM_Contact_BAO_GroupContactCache::remove(1234);

I also found a bug in GroupContactCache.php in 4.6.18, reported here: https://issues.civicrm.org/jira/browse/CRM-19005

0

Experienced the same problem...with 4.6.18

Went hunting through CiviCRM's JIRA issue tracker and found many interrelated issues surrounding smart group cache problems for 4.6

Look here and make the changes: https://github.com/civicrm/civicrm-core/pull/6694/files

The patch won't apply cleanly, but you can figure out where to make the 2 line change....

Also did the changes in this commit for good measure: https://github.com/civicrm/civicrm-core/pull/8637/commits/189d2597929fc6d39f2f587ec5696f74b0ea8775

Boom, immediately smart groups started to respond immediately

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.