--- civicrm.config.php +++ civicrm.config.php @@ -58,12 +58,34 @@ // to the script that invokes it $moduleDir = 'sites' . DIRECTORY_SEPARATOR . 'all' . DIRECTORY_SEPARATOR . 'modules'; $contribDir = $moduleDir . DIRECTORY_SEPARATOR . 'contrib'; + $profileDir = DIRECTORY_SEPARATOR . 'profiles' . DIRECTORY_SEPARATOR; // check to see if this is under sites/all/modules/contrib or subdir civicrm-core if ( strpos( $currentDir, $contribDir ) !== false || strpos( $currentDir, 'civicrm-core' ) !== false) { $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'; + + // drupal root is back one from the $confdir + define('DRUPAL_ROOT', $confdir . DIRECTORY_SEPARATOR . '..'); + require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; + // check to see if this is under sites/all/modules } else if ( strpos( $currentDir, $moduleDir ) !== false ) { $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'; + + // drupal root is back one from the $confdir + define('DRUPAL_ROOT', $confdir . DIRECTORY_SEPARATOR . '..'); + require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; + + // check to see if this is under profiles/[PROFILE]/modules + } else if ( strpos( $currentDir, $profileDir ) !== false ) { + + // in the profile, we need to go back to the root and then forward + // this is a bit more complicated + $drupalbase = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'; + define('DRUPAL_ROOT', $drupalbase); + require_once $drupalbase . '/includes/bootstrap.inc'; + + $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . conf_path(); + } else if ( strpos( $currentDir, 'plugins' . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm' ) !== false ) { //if its wordpress $confdir = $currentDir . DIRECTORY_SEPARATOR . '..';