This documentation relates to CiviCRM version 3.2. It's not maintained anymore.
Current version of documentation.

Views2 Integration Module

Skip to end of metadata
Go to start of metadata

This page refers to outdated version of CiviCRM. Check current version of documentation.


Documentation Search


CiviCRM 3.2 Documentation

Support and Participation

Developer Resources


CiviCRM book!

Make sure to check out Understanding CiviCRM as well! You can also support this project by ordering a hard copy.

Some tips and tricks for integrating Views2 and CiviCRM

  • If your CiviCRM install uses a different database to your Drupal install, ensure that your Drupal DB user has SELECT rights to your CiviCRM DB. Some hosting platforms might make this difficult. For more information about setting up Drupal multi-database access: http://drupal.org/node/18429
  • You will need to set database prefixes in your Drupal settings.php file so that Views2 can access your CiviCRM DB. The prefixes can be seen on a url like: http://drupal.demo.civicrm.org/civicrm/admin/setting/uf?reset=1. You will need to have Views2 enabled to see those settings. Important: You will have to update your settings.php with new prefixes every time you add new Custom Field Group.  Also, after making changes in civicrm you should clear Drupal's view cache at:  Administer › Site building › Views › Tools and press "Clear Views cache".
  • If you have CiviCRM and Drupal installed on the same database, and drupal tables are prefixed, you might receive an error in your views saying table does not exist, if this happens, you need to alter your drupal sites/default/settings.php file.  find the part that says $db_prefix = 'drupal_'; and change it to this: $db_prefix = array ('default'=>'drupal_','civicrm_event'=>'','civicrm_activity'=>'','civicrm_contact'=>'','civicrm_address'=>'','civicrm_contribution'=>'');  NOTE: your prefix may be something other then drupal_, just replace drupal_ with whatever prefix you have configured.
  • If the above steps dont work for you or your drupal/civicrm db's have a different user name/password, try this recipe from andrew: CiviCRM Views 2 integration with a remote CiviCRM database
  • A diagram from the work done by James Rakich

Diagram for civicrm_relationship table:

Labels
  • None
  1. Mar 15, 2009

    This is fantastic.  Note that you are changing $db_prefix to an array, you must add the default line to the list ie:

    $db_prefix = array(
      'default'                                  => 'd1',

    and the output from: http://drupal.demo.civicrm.org/civicrm/admin/setting/uf?reset=1 .

    Also - If you use html for the descriptions, the view is shown as plaintext and has to be converted to HTML.  not sure if anyone has done that but i'm interested.


Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.