Admin Settings do not Save with Portal Localization Enabled in DNN 7.3.2

DNN > Troubleshooting
Problem:
 
After adding localization (additional language) to your site, you can no longer change your admin settings pages. When you attempt to do so, you get the following error reports in DNN:
 
Cannot add key: Duplicate key exists
 
Cause
 
Due to an issue with DNN 7.3.2, adding portal languages changes the dbo.portalsettings table and duplicates entries. 
 
Solution:
 
1. Log into your site as superuser.
 
2. Go to Host > SQL and paste the following:
 
NOTE: This fix is intended for DNN 7.3.2 only. Do not run this script on *any* other version.
UPDATE {databaseOwner}[{objectQualifier}PortalSettings]
 SET   LastModifiedOnDate = '2000-01-01' 
 WHERE LastModifiedOnDate is Null
GO

IF OBJECT_ID(N'{databaseOwner}[{objectQualifier}GetPortalSetting]', N'P') IS NOT NULL
    DROP PROCEDURE {databaseOwner}[{objectQualifier}GetPortalSetting]
GO


CREATE PROCEDURE {databaseOwner}[{objectQualifier}GetPortalSetting]
    @PortalID    Int,		    -- Not Null
    @SettingName nVarChar(50),	-- Not Null
    @CultureCode nVarChar(50)	-- not Null
AS
BEGIN
	SELECT TOP (1)
		SettingName,
		CASE WHEN Lower(SettingValue) Like 'fileid=%'
		 THEN {databaseOwner}[{objectQualifier}FilePath](SettingValue)
		 ELSE SettingValue 
		END   AS SettingValue,
		CreatedByUserID,
		CreatedOnDate,
		LastModifiedByUserID,
		LastModifiedOnDate,
		CultureCode
	 FROM  {databaseOwner}[{objectQualifier}PortalSettings]
	 WHERE PortalID    = @PortalID
	   AND SettingName = @SettingName
	 ORDER BY LastModifiedOnDate DESC
END
GO

IF OBJECT_ID(N'{databaseOwner}[{objectQualifier}GetPortalSettings]', N'P') IS NOT NULL
    DROP PROCEDURE {databaseOwner}[{objectQualifier}GetPortalSettings]
GO

CREATE PROCEDURE {databaseOwner}[{objectQualifier}GetPortalSettings]
    @PortalId    Int,            -- not Null!
    @CultureCode nVarChar(20)    -- not Null!
AS
BEGIN
	SELECT
		SettingName,
		CASE WHEN Lower(SettingValue) Like 'fileid=%'
		 THEN {databaseOwner}[{objectQualifier}FilePath](SettingValue)
		 ELSE SettingValue 
		END   AS SettingValue,
		CreatedByUserID,
		CreatedOnDate,
		LastModifiedByUserID,
		LastModifiedOnDate,
		CultureCode
	 FROM  {databaseOwner}[{objectQualifier}PortalSettings] P
	 JOIN  (SELECT PortalID, SettingName SN, Max(LastModifiedOnDate) MD
	        FROM {databaseOwner}[{objectQualifier}PortalSettings] 
			WHERE PortalID = @PortalId
			GROUP BY PortalID, SettingName) S 
	   ON P.PortalID = S.PortalID AND P.SettingName = S.SN AND P.LastModifiedOnDate = S.MD;
END
GO
 
3. Click Run Script.
 
This script will remove the duplicate entries, and repair the affected tables.
 
 
Reference:
 
 
 
 

Add Feedback