From 5cce7cb5197380980f59abf6c2098afde58f9082 Mon Sep 17 00:00:00 2001 From: Scott Hutchinson Date: Sun, 18 Nov 2018 14:08:53 +1300 Subject: [PATCH] FIX app email templates not resolving correctly --- code/Model/Recipient/EmailRecipient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/Model/Recipient/EmailRecipient.php b/code/Model/Recipient/EmailRecipient.php index 0c686a4..8201842 100644 --- a/code/Model/Recipient/EmailRecipient.php +++ b/code/Model/Recipient/EmailRecipient.php @@ -506,8 +506,8 @@ class EmailRecipient extends DataObject $templatePath = substr($absoluteFilename, strlen($prefixToStrip) + 1); // Optionally remove "templates/" prefixes - if (substr($templatePath, 0, 10)) { - $templatePath = substr($templatePath, 10); + if (preg_match('/(?<=templates\/).*$/', $templatePath, $matches)) { + $templatePath = $matches[0]; } $templates[$templatePath] = $template['filename'];