DNN pages wrong order (DNN 5.3 & 5.4)
If a page is moved either with the pages module or from the page
settings, it can be that the pages Tabpath and Level are out of sync. In
that case pages disappear or appear in places they shouldn't
Get All pages with the described issue.
SELECT tabid,
taborder,
portalid,
tabname,
isvisible,
parentid,
level,
isdeleted,
tabpath
FROM tabs
WHERE NOT ( ( Len(tabpath) - Len(Replace(tabpath, '//', '')) ) / Len('//') - 1
= level
)
Correct the issue described for all pages
UPDATE tabs
SET level = ( Len(tabpath) - Len(Replace(tabpath, '//', '')) ) / Len('//') - 1
TabPath and level out of sync
I found that sometimes pages can have the correct tabpath and parentid but the wrong level.
In that case the Level of Tab and Parent are the same.
Find pages with this issue:
SELECT *
FROM (SELECT tabid,
portalid,
tabname,
[level] AS TabLevel,
parentid,
parentlevel
FROM tabs T
JOIN (SELECT tabid AS PId,
[level] AS ParentLevel
FROM tabs Parent) P
ON ( P.pid = T.parentid )) AS X
WHERE tablevel > 0
AND NOT tablevel - parentlevel = 1
Sibling pages with the same name.
In DNN 4 you could create 2 pages with the same name on the same level in a portal.
This is not allowed in DNN 5, but an upgraded site (4>5) could still
have them as they were allowed in DNN4, which could cause issues.
In some later versions it was also possible to create this issue by moving the a page.
Find pages with this issue:
SELECT items,
tabpath,
tabname,
portalid
FROM (SELECT Count(tabpath) AS Items,
tabname,
tabpath,
portalid
FROM tabs
WHERE tabpath NOT LIKE '%Admin%'
AND tabpath NOT LIKE '%Host%'
GROUP BY tabname,
tabpath,
portalid) AS Temp
WHERE items > 1