• 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?

#1
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):
PHP:
class MyAddon_ControllerPublic_Login extends XenForo_ControllerPublic_Abstract
{
    public function actionIndex()
    {
        die("Hello!");
    }
}
 

Jeremy

Well-known member
#3
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.
 

tyteen4a03

Well-known member
#4
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.
Wouldn't using a custom RoutePrefix, then redirecting original route to custom route via the router be a better idea?
 

Jeremy

Well-known member
#5
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. :)