Global module settings in DotNetNuke
It’s easy to persist settings for an instance of DotNetNuke modules using ModuleController.GetModuleSettings(moduleId). But sometimes you want module settings to apply to all instances of a module within a given portal. I needed to do this for a module and used the following code:
PortalSettings portalSettings = (PortalSettings) HttpContext.Current.Items[“PortalSettings”];
ModuleController moduleController = new ModuleController();
ModuleInfo moduleInfo = moduleController.GetModuleByDefinition(portalSettings.PortalId,”Site Settings”);
int globalModuleId = moduleInfo.ModuleID;
Hashtable globalSettings = moduleController.GetModuleSettings(globalModuleId);
I suspect there may be better ways to achieve this objective, but this seems to get the job done. If anyone knows a better way please post in comments.