I want to generate membership cards based on a person's geographical region. The region logic is fairly complex (e.g. "Anyone in NY, plus New Jersey north of Trenton and Connecticut west of Stamford"). I have smart groups that accurately place someone by region.

Before we used smart groups, we manually added folks to static groups based on region. An extension called civicrm_post on the GroupContact to set the custom field. However, civicrm_post isn't called on smart groups.

Does anyone have any ideas? I don't mind using SQL in a cron job, but I'm not sure that civicrm_group_contact_cache is reliably filled with the correct data - in older versions of Civi at least, I often found it empty.

This is Civi 4.6.10, Wordpress.

1 Answer 1


In your own cron job you could reload the cache for groups by calling civicrm_api3_job_group_rebuild() (https://github.com/civicrm/civicrm-core/blob/master/api/v3/Job.php#L629), then cycle through the group to fill your custom field.

  • Brilliant, Joe. This work is scheduled for a couple of weeks from now, I'll mark it accepted assuming this works! Dec 3, 2015 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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