Detect root parent forum
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?
Parent > Child > Subchild > Subsubchild
Regardless of being in Child, subchild or subsubchild, I want to always get the Parent ID.
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.
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.endclient side event.