CiviCRM integration with views ...

2008-06-28 14:03
Written by
The Drupal Views module has some pretty cool functionality. Views 2 fixed the "everything is a node" concept from Views 1, this enables integration with CiviCRM (which does nothing with nodes). A concise description of Views from its project page: This tool is essentially a smart query builder that, given enough information, can build the proper query, execute it, and display the results. CiviCRM profiles (in view/search mode) behaves like views. However it is not a flexible or configurable as views is for the end user. Integrating with views also allows the potential of integrating CiviCRM information with other Drupal specific information. e.g. Contact information on folks who are most active on your blog / forum / comments I took as a model and started hacking away to create You can get a copy of that file from our svn respository. So far its quite simple and just integrates the civicrm_contact and civicrm_email tables. I hope to add the phone/address fields in the next couple of hours/days and get a better idea of how to potentially generalize it. I'd like to generate that entire file ( directly from our xml schema definition. We know most of the information we need there and with a few smarty class stubs, i think we can do this easily.. This will allow us to improve and support a lot of the core civicrm tables and also the various component tables (contribiution, membership etc) One thing which i have not yet figured out is if views can generate sql queries across multiple dbs. In the past we have recommended that folks store the civicrm data in a separate db, so multi-db support would be nice. MySQL does support it (with appropriate permissions), so you can have a query like:
SELECT d.uid,,, c.display_name
FROM   drupal6.users d,
       civicrm21.civicrm_contact c,
       civicrm21.civicrm_uf_match uf
WHERE  uf.uf_id = d.uid
AND    uf.contact_id =
If you are a views/civicrm hacker and have an interest in pushing this project forward, please contact me via email/irc Update: I've made quite a bit of progress and now understands the email and contact table. I'll start adding more fields and automate that over the next few days. Once Views2 goes RC, i'll add it to sandbox so folks can get an idea of the power of a CiviCRM / Views integration
Filed under


Guest (not verified)
2009-07-31 - 08:13