diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e224e8..5fd9e9a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Notification Center Changelog =========================== +Version 1.3.6 (2016-05-04) +-------------------------- + +### Fixed +- Support the language variations (e.g. en-US) (#93) + + Version 1.3.5 (2016-03-02) -------------------------- @@ -8,6 +15,13 @@ Version 1.3.5 (2016-03-02) - The extension is now compatible with PHP7 (see #86) +Version 1.3.4 (2016-02-09) +-------------------------- + +### Improved +- The extension is now compatible with Contao 4 + + Version 1.3.3 (2016-01-15) -------------------------- diff --git a/library/NotificationCenter/ContaoHelper.php b/library/NotificationCenter/ContaoHelper.php index d112a09e..05c510d1 100644 --- a/library/NotificationCenter/ContaoHelper.php +++ b/library/NotificationCenter/ContaoHelper.php @@ -59,7 +59,7 @@ public function sendRegistrationEmail($intId, $arrData, &$objModule) $objNotification = \NotificationCenter\Model\Notification::findByPk($objModule->nc_notification); if ($objNotification !== null) { - $objNotification->send($arrTokens); + $objNotification->send($arrTokens, $GLOBALS['TL_LANGUAGE']); // Disable the email to admin because no core notification has been sent $objModule->reg_activate = true; @@ -108,7 +108,7 @@ public function sendPersonalDataEmail($objUser, $arrData, $objModule) $objNotification = \NotificationCenter\Model\Notification::findByPk($objModule->nc_notification); if ($objNotification !== null) { - $objNotification->send($arrTokens); + $objNotification->send($arrTokens, $GLOBALS['TL_LANGUAGE']); } } diff --git a/library/NotificationCenter/Model/Language.php b/library/NotificationCenter/Model/Language.php index 02c25c32..b5205e58 100644 --- a/library/NotificationCenter/Model/Language.php +++ b/library/NotificationCenter/Model/Language.php @@ -28,6 +28,9 @@ public static function findByMessageAndLanguageOrFallback(Message $objMessage, $ { $t = static::$strTable; + // Support the language variations (e.g. en-US) + $strLanguage = str_replace('-', '_', $strLanguage); + $arrColumns = array("$t.pid=?", "($t.language=? OR $t.fallback=1)"); $arrValues = array($objMessage->id, $strLanguage); $arrOptions = array('order' => 'fallback'); diff --git a/modules/ModulePasswordNotificationCenter.php b/modules/ModulePasswordNotificationCenter.php index 394c4208..64f7961b 100644 --- a/modules/ModulePasswordNotificationCenter.php +++ b/modules/ModulePasswordNotificationCenter.php @@ -65,7 +65,7 @@ protected function sendPasswordLink($objMember) $arrTokens['domain'] = \Idna::decode(\Environment::get('host')); $arrTokens['link'] = \Idna::decode(\Environment::get('base')) . \Environment::get('request') . (($GLOBALS['TL_CONFIG']['disableAlias'] || strpos(\Environment::get('request'), '?') !== false) ? '&' : '?') . 'token=' . $confirmationId; - $objNotification->send($arrTokens); + $objNotification->send($arrTokens, $GLOBALS['TL_LANGUAGE']); $this->log('A new password has been requested for user ID ' . $objMember->id . ' (' . $objMember->email . ')', __METHOD__, TL_ACCESS); // Check whether there is a jumpTo page