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

Getting child forum threads in parent forum

#1
Hi all,

I'm trying to make and add-on to allow a parent forum to display also all threads of its child forums. I can do it in many ways, but I would like to do it the right way! :)

At first, I thought about extending the prepareThreadConditions() of the Thread model so I can change the $conditions['node_id'] to an array and them call the base prepareThreadConditions().

But I could also change the getThreads() from the same model, the actionList() of Thread Controller or even the actionForum() of the Forum Controller... The list goes on...

So, my question is: What would be the best class:function, following best coding practices, to extend to achiev this?

Thank you in advance!
 
#2
Ok, ok... I choosed XenForo_Model_Thread::getThreadsInForum() to extend. I would still have the getThreads() unchanged, so it's still possible to retrieve only the parent forum threads if needed. If anyone think there is a better option or codding practice, please let me know!
 
Last edited:

Aayush

Well-known member
#3
I generally override controllers rather than models. I only override models when I am 100% sure that every call from any other controller to that function will not get harmed or slowed down by the additional stuff I am injecting to the function.