Note: currently this feature is partially broken, since OG has changed substantially since I did the patch, and I haven't been able to keep up. If you're interested in this feature and can support the work financially, please contact Rob using my Drupal.org contact form.
Organic Groups support is actually pretty simple, although it does require a patch to og.module.
When an admin creates an organic group, there's a bit of additional UI towards the bottom of the form that creates an option to link your organic group to a CiviCRM group. If you don't link to a CiviCRM group, your group is an ordinary organic group. If you link, then any contact in the linked group is subscribed to the Drupal organic group just as soon as the user logs in. If the contact is matched to a new Drupal user, the Drupal user does not even have to exist when the organic group is created.
To make this work, I needed to patch og.module to extend Moshe's hook_og: I need to get in some code after organic groups starts loading its user information, but before it sets up $nod->og_groups, which is the list of organic groups the user belongs to. The patch is described on Drupal.org.
Moshe has not to date accepted the patch, so if you need to use my organic groups code, you'll need the patch. I'll keep an updated version of the patch attached to this page for now; hopefully if enough of us need it, we can get the patch in eventually. For now, I'm using CVS revision 1.50, which is a few behind; I'll update periodically as needed.
Organic Groups support owes a fair bit to Gerhard Killesreiter's og_civicrm.module, but works a little differently. Both Killes' work and mine link a Drupal organic group to a CiviCRM group, but having used og_civicrm in a demo application I've spent a couple of months on, I've found it has several significant limitations:
For all of these reasons, a little more UI led to a much simpler design.
| Attachment | Size |
|---|---|
| og.module | 72.52 KB |