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?
2 Answers
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? Commented Mar 22, 2016 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 ♦Commented Mar 22, 2016 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}")
;)