Formerly
Formerly copied to clipboard
Error when multiple siteUrls in config
If Craft's config-file has an array of siteUrls, for localization purposes, line 259 of the SubscriptionService throws an error on submission:
$result = str_replace("{siteUrl}", craft()->config->get("siteUrl"), $result);
It seems that Formerly has no support for multiple languages yet.
yeah sorry we have no need for multi languages at this point so can't justify the time involved with my bosses. If anyone wants to add this that would be awesome
This is actually pretty easy to resolve assuming:
- you are using the locale set-up recommended by P&T - see http://buildwithcraft.com/docs/multi-environment-configs
- you are declaring your locale via a global variable, eg CRAFT_LOCALE. For example, in my site root (index.php) I am declaring a global variable based on a switch conditional against
$_SERVER['SERVER_NAME']
- see http://buildwithcraft.com/docs/php-constants
In formerly/services/Formerly_SubmissionsService.php
you need to add a conditional based on your locale to line 260:
if (count(craft()->config->get("siteUrl")) > 0) $result = str_replace("{siteUrl}", craft()->config->get("siteUrl")[CRAFT_LOCALE], $result);
else $result = str_replace("{siteUrl}", craft()->config->get("siteUrl"), $result);
Will see if can sort a pull request for this.