We'd like to pass a Drupal field (Organic Group that a user belongs to) to a CiviCRM membership report. Has anyone done this and could give pointers or an example?

up vote 2 down vote accepted

One option would be to do this with Drupal Views though I think you would end up needing to display a View within a View to deal with the multiple results you could have for both the OG memberships and the Civi Memberships. I did a quick proof of concept to check if all the joins were available which I attached to this blog.

  • Hey Pete, I just wanted to come back and let you know that this is pretty much what we implemented - thank you. One question: when we created our view, we used "User" as the data, rather than CiviCRM Contacts - and then just set up a relationship to open up the CiviCRM fields. Do you think this was the wrong approach? – Alex Katayama Mar 22 '16 at 17:59
  • Hi Alex. Hard to 'guess'. But yes I can see that you could start at either end of the daisy chain. I have often started at one end, and then if i hit any issues just reversed and built from the other end. Perhaps you could 'accept' this question and keep StackExchange happy – petednz - fuzion Mar 22 '16 at 18:30

If you want to do this in code, you should be able to use the Drupal API to access all Drupal tables and fields in your code ($result = db_query("SELECT nid, title FROM {node}");)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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