From 7839da7d967ac37d6c5a6e60a97bc3cd80f2457e Mon Sep 17 00:00:00 2001 From: "Ismet D." <64033786+idumlupinar@users.noreply.github.com> Date: Wed, 21 Oct 2026 11:38:24 +0300 Subject: [PATCH] Improve UserTabId assignment in PortalController Refactor UserTabId assignment logic for better clarity and fallback handling. --- .../Library/Entities/Portals/PortalController.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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;