Detect root parent forum


  • Gamers

    Hello,

    I was wondering, do you know of a way in which I can always get the root parent forum ID, regardless of what subforums I have within it?

    Example Forum:

    Parent > Child > Subchild > Subsubchild

    Regardless of being in Child, subchild or subsubchild, I want to always get the Parent ID.

    I plan on detecting if a certain forum id = matches x then overwrite some of the CSS with javascript or make it add an additional id to certain elements, which I can use CSS to then overwrite some colours etc.

    Also, is there a way I can detect when people are switching between the pages? so I can revert changes if they are not within those forums anymore?

    Thanks in advance.


  • Admin

    To get the root parent you would have to write a plugin and traverse up until you hit parentCid=0, this isn't available in core.

    To detect page changes listen to the action:ajaxify.end client side event.


 

Suggested Topics

| |