There seems to be a problem in WordPress documentation for config.settings.php for Multisite installs
OK. So I've found what I think is a pretty serious problem with the current Civi CRM setup/documentation for 5.3 (and probably a few subversions before) and Wordpress multisites...
I've posted these problems at Stack Exchange:
https://civicrm.stackexchange.com/questions/25688/im-having-new-trouble-with-civicrm-in-multisites-in-wordpress https://civicrm.stackexchange.com/questions/25713/getting-cors-error-from-civicrm-dashboard-dashlets/
I was pointed at the documentation update that should be happening soon: https://github.com/civicrm/civicrm-sysadmin-guide/pull/104/files
That helped one aspect of it, ie getting the subsites all using the same setup.
But as documented above, there were still problems involving CORS
I finally think I traced it to the following.
There's an entire section up the top of civicrm.settings.php that has these lines:
$civicrm_paths['wp.frontend.base']['url'] = (URL path)
$civicrm_paths['wp.backend.base']['url'] = (URL path to admin)
$civicrm_setting['URL Preferences']['userFrameworkResourceURL'] =(URL path) to civicrm
The paths are hardcoded to the main site URL.
This seems to be what's causing these problems I'm having. Because if I change it using the code below, then it appears to work again.
=======================
if(function_exists('is_multisite') && function_exists('home_url')) {
$url = home_url();
}
else {
$protocol = strstr('HTTPS', $_SERVER['SERVER_PROTOCOL']) ? 'https://' : 'http://';
$url = $protocol . $_SERVER['SERVER_NAME'];
}
// Additional settings generated by installer:
$civicrm_paths['wp.frontend.base']['url'] = $url.'/';
$civicrm_paths['wp.backend.base']['url'] = $url.'/wp-admin/';
$civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = $url.'/wp-content/plugins/civicrm/civicrm';
Note that this does NOT include the recommended code that is on the current WP multisites documentation page.
BUT, I do not know what the implications are here down the track. Will this cause other problems? I'd really like a dev to weigh in and check if this fix is legitimate or will make something explode down the track.
As mentioned in the GitHub sysadmin guide pages, people are working to update this documentation.
My core confusion is which section applies to what we're trying to do. ie if we want to share CiviCRM across all the subsites, then what's the procedure there. And if they need to be separated, then what's the procedure. I realise this is complicated by the different install bases that exist. Like Drupal, Wordpress, Joomla and any others.
But if each section was clear about what it was doing, that would help. ie. if the instructions are common to all installs, then make that clear. And then specifics for each install platform.