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

Discussion in 'XenForo Development Discussions' started by Alexandre Góes, Sep 8, 2014.

  1. Alexandre Góes

    Alexandre Góes New Member

    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. Alexandre Góes

    Alexandre Góes New Member

    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: Sep 9, 2014
  3. Aayush

    Aayush Well-Known Member

    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.

Share This Page