2

The use case I have is as follows:

An organization has multiple chapters, and it's important to record which chapter the person is in. For a variety of good reasons (e.g. ACLs), chapters are represented by adding the contact to a group. When adding a contact to a group, a hook_post in an extension fires, and fills out a custom field with the name of the chapter they're in.

However, the chapter of a member is determined by location, so we want to move to using smart groups that can automatically classify contacts into chapters. However, when a user is added via Smart Group, the hook doesn't fire, and the custom field's not filled in.

Any suggestions? I'm open to reorganizing the data - but the users would really like to have folks automatically classified into chapters by geography (zip code ranges, etc.) and so I think this requires that chapters be set by smart group. It's OK if an answer requires coding, I'm civix-savvy.

This site is using CiviCRM 4.4.16, Wordpress 4.2.2.

2 Answers 2

1

I think we have a client where a postcode look up (on Contact save) triggers creation of a Relationship being made. The Relationship connects the Individual to the Regional Group (contact of type Org'n). You could then use our Relationships as ACL extension to run your 'access rules' from. I will ping JoAnne to comment further if she can.

From JoAnne: I'll add to this rather than comment.

There is a table in the db linking every postcode/suburb combination to one of the 200+ organisations of type "local group".

The initial relationship is created when a person signs up for a specified membership type.

With any change in a member's primary address, the relationship is re-checked. If warranted, that relationship is ended and a new one created with the new local group.

0

Use a post hook on Address instead? You could even have that hook take care of the group move as well as the custom field move. Editing someone so that they meet Smart Group criteria probably wouldn't cause an update hook right away because the content of a smart group is only updated when someone looks at it (and that lookup exceeds the cache timeout).

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.