I have tried with very little success to retrieve a custom portal setting. I've attempted using the PortalController, PortalSettings, and finally with some success with DataProvider.Instance().
// works as intended
DataProvider.Instance().UpdatePortalSetting(PortalId, MY_CUSTOM_SETTING, MY_VALUE, UserId, "en-US");
// does not work
new PortalController().GetPortalSettings(PortalId).TryGetValue(MY_CUSTOM_SETTING, out string MY_VALUE);
// also does not work
PortalController.GetPortalSetting(MY_CUSTOM_SETTING, PortalId, "False") // false is the default value that is always returned since this call fails
I have also tried:
// not working
DataProvider.Instance().GetPortalSettings(int PortalId, string CultureCode)
// works for updating my custom value
DataProvider.Instance().UpdatePortalSetting(PortalId, ConstEnableCaptcha, enabled, UserId, "en-US");
However this returns an IDataReader object which isn't very helpful.
Is there a function way to retrieve portal settings? I read a slightly old article that stated that the stored procedures that these methods use are non-functional after several new fields were added to that table.
Small update it appears that there's a caching issue with portal settings. I need to manually clear the cache after the setting has been updated for the updated value to return properly.