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

[Solved] Invalid Controller Class

Adam K M

Active member
#1
Hello,

I'm trying to properly extend an already existing controller (account), but when I try to save the code event listener, I get the following error:
invalidclass.png
The Invalid class error isn't very descriptive, and I'm not quite sure what to do with it. Testing some classes that didn't exist, I also got the same error, so I suspect that XenForo is unable to locate my controller, but I have been unable to pinpoint where I've gone wrong with the naming/folder organisation .

Here is the setup that I've currently got running on my development forum
My LoadClassController
PHP:
<?php

class ShortCut_GuidArea_LoadClassController
{
    /**
     * Instruct the system that XenForo_ControllerPublic_Account
     * should be extended by our own class
     *
     * @param string $class
     * @param array $extend
     */
    public static function extendMemberController($class, array &$extend)
    {
        if ($class == 'XenForo_ControllerPublic_Account')
        {
            $extend[] = 'ShortCut_GuildArea_guildpage';
        }
    }
}
The directory:
Code:
/public_html/dev*/library/ShortCut/GuildArea
* corresponds to the root of the installation.
Any / All advice on what's going wrong is greatly appreciated. As for my guildpage class, it works properly (hooray!) if I insert it directly in the ControllerPublic_Account class (boo! bad practice!).
 

Adam K M

Active member
#5
Tip:
Add this to event hint for a tiny performance boost: XenForo_ControllerPublic_Account
One last question - and I realise that this might go out of the scope of my original question, but...

How do I go about 'packaging' a template along with my plugin? I looked at template modifications, however I don't see a way to have my plugin create a brand new template with itself.