• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Root node of a particular forum

Valhalla

Well-known member
#1
I haven't had much chance to look at this, but is there a quick way to find out the parent-most (root) node of a particular forum?

For example, the Media Gallery Resolved Bugs forum (89) has the parent of Media Gallery Bug Reports (88), but it's root is the Official XenForo Add-ons category (54). It's the latter that I'd wish to find.

Could the getPossibleParentNodes method work for this task?
 

Valhalla

Well-known member
#2
I think this is the best way.

Code:
SELECT node_id
FROM xf_node
WHERE node_id='x' AND
lft < (SELECT lft FROM xf_node WHERE node_id='x' LIMIT 1) OR
rgt > (SELECT lft FROM xf_node WHERE node_id='x' LIMIT 1)
LIMIT 1