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

Which method to use to replace a stock ControllerPublic?

Discussion in 'XenForo Development Discussions' started by LennardF1989, Jul 13, 2013.

  1. LennardF1989

    LennardF1989 Member

    Which method do I use to complete replace a stock ControllerPublic. As in, not extend upon it, but completely rewrite it?

    I figure there are two methods to this:
    1. Replace the stock route (eg. login) in an add-on to point to your custom ControllerPublic, is that even possible?
    2. Extend and override all the methods using a Listener

    Option 1 obviously seems the best, but is it really? Did I miss another potential trick to achieve the same result?

    I want to replace XenForo_ControllerPublic_Login with the following logic (for testing purposes, I should add):
    class MyAddon_ControllerPublic_Login extends XenForo_ControllerPublic_Abstract
        public function 
  2. tyteen4a03

    tyteen4a03 Well-Known Member

    Why would you want to do so?
  3. Jeremy

    Jeremy Well-Known Member

    If I remember correctly, he is attempting to authenticate completely outside of XenForo. You may want to look into my posting history and the discussions on XenForo_Authentication, it may be what you actually want.
  4. tyteen4a03

    tyteen4a03 Well-Known Member

    Wouldn't using a custom RoutePrefix, then redirecting original route to custom route via the router be a better idea?
  5. Jeremy

    Jeremy Well-Known Member

    Well, yes, and that would be my next suggestion, but XenForo depends on quite a bit of account information, so disabling the modification of passwords (or overwriting it) and changing the authentication method is my prime suggestion, and may be the easiest to properly code. :)
    tyteen4a03 likes this.
  6. LennardF1989

    LennardF1989 Member

    I ended up using method one and it works just fine.

Share This Page