diff --git a/DNN Platform/Library/Entities/Portals/PortalController.cs b/DNN Platform/Library/Entities/Portals/PortalController.cs index 225d50b545c..1c971d712a5 100644 --- a/DNN Platform/Library/Entities/Portals/PortalController.cs +++ b/DNN Platform/Library/Entities/Portals/PortalController.cs @@ -2637,13 +2637,23 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi IPortalInfo portal = obsoletePortal; portal.Description = description; portal.KeyWords = keyWords; - portal.UserTabId = TabController.GetTabByTabPath(portal.PortalId, "//UserProfile", portal.CultureCode); + + // The template sets these from its usertab/searchtab markers; tab paths are only a fallback, + // since they are built from tab names and do not match localized templates. if (portal.UserTabId == -1) { - portal.UserTabId = TabController.GetTabByTabPath(portal.PortalId, "//ActivityFeed", portal.CultureCode); + portal.UserTabId = TabController.GetTabByTabPath(portal.PortalId, "//UserProfile", portal.CultureCode); + if (portal.UserTabId == -1) + { + portal.UserTabId = TabController.GetTabByTabPath(portal.PortalId, "//ActivityFeed", portal.CultureCode); + } + } + + if (portal.SearchTabId == -1) + { + portal.SearchTabId = TabController.GetTabByTabPath(portal.PortalId, "//SearchResults", portal.CultureCode); } - portal.SearchTabId = TabController.GetTabByTabPath(portal.PortalId, "//SearchResults", portal.CultureCode); this.UpdatePortalInfo(obsoletePortal); adminUser.Profile.PreferredLocale = portal.DefaultLanguage;