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

How to manipulate a _input->filterSingle variable?

Discussion in 'XenForo Development Discussions' started by Marcus, Jul 18, 2013.

  1. Marcus

    Marcus Well-Known Member

    In ControllerPublic_Forum::actionIndex I want to manipulate _input->filterSingle('node_id') to show threads of a different forum.

    The idea is to call my extended class first, manipulate _input->... and then call XenForo_ControllerPublic_Forum::actionIndex.

    $this->_input->filterSingle('node_id', XenForo_Input::UINT) = $myVariable does not work. Do you know how I could do it?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    You need to modify the appropriate $_POST or $_GET variables See xf_phantom's solution below before calling parent::actionIndex(); It'll pick up accordingly.
     
    Last edited: Jul 18, 2013
    Marcus likes this.
  3. xf_phantom

    xf_phantom Well-Known Member

    With $this->getRequest()->setParam('node_id', 100); you'll be able to set a request variarble inside the controller.

    e.g. ( in the proxy class before the parent action is being called, or you could use the _preDispatch method)
     
    Last edited: Jul 18, 2013
    Marcus, Jeremy, AlexT and 1 other person like this.
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    ^ That is an even better and the proper way to do it. (y) Nice find, xf_phantom.
     
  5. xf_phantom

    xf_phantom Well-Known Member

    That's pre xf 1.2 , right?:D
     
  6. Marcus

    Marcus Well-Known Member

    Yes :)) OK I updated my XenForo, I paid for the upgrade a year ago and got the nice license extension. You are indeed a very resourceful and helpful phantom!!
     
  7. Marcus

    Marcus Well-Known Member

    I just see, XenForo 1.2 has a much cleaner code, ControllerPublic_Forum:actionIndex (1.2 version) is just a fraction of its 1.1 code. Thumbs up !
     
  8. Chris D

    Chris D XenForo Developer Staff Member

    Only because the bulk of that code is now in actionForum.

    The index action now handles the rerouting to the custom index controller.
     
    tyteen4a03 and Marcus like this.

Share This Page