1. 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

Discussion in 'XenForo Development Discussions' started by Valhalla, Nov 16, 2014.

  1. Valhalla

    Valhalla Well-Known Member

    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?
     
  2. Valhalla

    Valhalla Well-Known Member

    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
    
     

Share This Page