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

Triggering a reroute from controller_pre_dispatch?

Discussion in 'XenForo Development Discussions' started by Jake B., Sep 9, 2015.

  1. Jake B.

    Jake B. Well-Known Member

    In controller_pre_dispatch XenForo_Controller is made available, but I can't seem to find anything that will let me trigger a responseReroute. I can't do a return from this code event listener, so I'm not entirely sure if this is possible. Any assistance would be great :D
     
  2. Jake B.

    Jake B. Well-Known Member

    I've tried this already:

    Code:
    throw $controller->responseException(
    $controller->responseReroute('ControllerClass', 'action')
    );
    
    but it doesn't seem to do what I want :S
     
  3. Liam W

    Liam W Well-Known Member

    That would work, what do you want it to do?

    Liam
     
  4. Jake B.

    Jake B. Well-Known Member

    It doesn't seem to be doing anything, I'm just wanting it to reroute.
     
  5. Jake B.

    Jake B. Well-Known Member

    Actually it looks like my listener isn't even being called.. Hm.
     
  6. Liam W

    Liam W Well-Known Member

    A couple of things...

    Are you sure the listener is being called (check for the hint & any if statements).

    I've used the same system before, and it worked for me...

    Liam
     
  7. Jake B.

    Jake B. Well-Known Member

    Yeah, i've found the issue. Apparently at some point during my testing I threw a return into XenForo_Controller::preDispatch just before the XenForo_CodeEvent::fire and forgot to remove it. Seems to be working now.
     

Share This Page