0

This question arose from this discussion.

4

There is documentation covering setting up multisite CiviCRM on multisite Wordpress here.

Additionally, this is an example of the code I put into civicrm.settings.php to set the base URL based on the domain:

  $multi_site_path = explode("/", $_SERVER[REQUEST_URI]);
  if ($multi_site_path[6] == "cron.php") {
      $multi_site_choice = $_GET["site"];
  } else {
      $multi_site_choice = $multi_site_path[1];
  }

  switch ($multi_site_choice) {

  case 'hcnmd':
    define( 'CIVICRM_DOMAIN_ID', 2 );
    define( 'CIVICRM_DOMAIN_GROUP_ID', 74);
    define( 'CIVICRM_DOMAIN_ORG_ID', 67459);
    define( 'CIVICRM_UF_BASEURL'      , 'http://hcn.local/hcnmd' );
    $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = 'http://hcn.local/hcnmd/wp-content/plugins/civicrm/civicrm';
    break;

  case 'hcfat':
    define( 'CIVICRM_DOMAIN_ID', 3 );
    define( 'CIVICRM_DOMAIN_GROUP_ID', 65);
    define( 'CIVICRM_DOMAIN_ORG_ID', 82031);
    define( 'CIVICRM_UF_BASEURL'      , 'http://hcn.local/hcfat' );
    $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = 'http://hcn.local/wp-content/plugins/civicrm/civicrm';
    break;     

  ...more multi-site config here...

  case 'wp-admin':
  case '':
  case false:
  default:
    define( 'CIVICRM_DOMAIN_ID', 1 );
    define( 'CIVICRM_DOMAIN_GROUP_ID', 84);
    define( 'CIVICRM_DOMAIN_ORG_ID', 1);
    define( 'CIVICRM_UF_BASEURL'      , 'http://hcn.local/' );
    $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = 'http://hcn.local/wp-content/plugins/civicrm/civicrm';
    break;
  • 1
    Thank you for posting this. I'm sure it'll help others trying to achieve something similar. – Christian Wach Feb 12 '16 at 11:07
  • Are the CIVICRM_DOMAIN_GROUP_ID and CIVICRM_DOMAIN_ORG_ID constants needed? They don't appear to be in the CiviCRM codebase --- at least not for WordPress. – Martin_ATS Aug 31 '18 at 16:03
  • I believe those are present in the Multisite Permissioning extension; if you're not using that, I imagine they're not necessary. – Jon G - Megaphone Tech Aug 31 '18 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.