veda-consulting-company / uk.co.vedaconsulting.mosaico

Other
39 stars 74 forks source link

Mosaico template fails to load in WordPress instance on Bedrock installation #565

Open masetto opened 1 year ago

masetto commented 1 year ago

This might be related to #543 and/or #553.

Environment information: CiviCRM 5.57.1 on Wordpress 6.1 installed with Bedrock

When I try to edit a Mosaico Template (https://mysite.com/wp/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fmosaico-template-list) a black screen is displayed because it loads the template here: https://mysite.com/wp//app/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/versafix-1/template-versafix-1.html instead of https://mysite.com/app/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/versafix-1/template-versafix-1.html.

CIVICRM_UF_BASEURL is set as https://mysite.com/wp

My .env file is:

WP_HOME='https://mysite.com'
WP_SITEURL="${WP_HOME}/wp"

I have many installations done that and so far I have had no problems.

The problem is on row 81 of /var/www/crm/web/app/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/api/v3/MosaicoTemplate.php:

$currentURL = CRM_Utils_System::baseURL() . $templatePath;

CRM_Utils_System::baseURL() is https://mysite.com/wp, but in this context it should be https://mysite.com (without /wp).

mo-g commented 1 year ago

We have a suspiciously similar problem on a drupal 7 install. Instead of pointing to https://mysite.com/sites/default/files/civicrm/extensions/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/versafix-1/template-versafix-1.html, instead it's looking for the template in https://mysite.com/templates/versafix-1/template-versafix-1.html. For now we've bodged it by symlinking the versafix-1 folder, but there's clearly a bug here!

We've recently installed monthly patch cycle, but no major version of PHP.