Aller directement à la fin des métadonnées
Aller au début des métadonnées

EDIT: The instructions for Views 3 have been moved to their own page.  

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:
  • 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: 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".  For examples of how to modify Drupal settings.php, refer to this post:
  • 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:

  1. Mar 15, 2009

    shawn holt dit :

    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: .

    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.