Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Plugin Controller Method Override (Vanilla 2 Sub-Categories)
Hey,
I'm trying to write a plugin that will enable adding of sub-categories in vanilla 2.
I'm having problems overriding the default view for "Categories Add" method but anything I try does not work for me.
I Tried the following in my Plugin class:
But it does not work. I've also tried the following:
and still no luck. Any help greatly appreciated.
I'm trying to write a plugin that will enable adding of sub-categories in vanilla 2.
I'm having problems overriding the default view for "Categories Add" method but anything I try does not work for me.
I Tried the following in my Plugin class:
public function CategoriesController_Add_Override(&$Sender){
$Sender->Render('views/categories/add.php');
}
But it does not work. I've also tried the following:
public function CategoriesController_Add_Render_Override(&$Sender){
$Sender->Render('views/categories/add.php');
}
and still no luck. Any help greatly appreciated.
Tagged:
0
Comments
So basically what you do is hook the Render() call for all methods on SettingsController, and then check Gdn::Dispatcher()->ControllerMethod() to detect when your particular method is being called and take action at that point.
public function SettingsController_Render_Before($Sender) { if (Gdn::Dispatcher()->Application() == 'vanilla' && Gdn::Dispatcher()->ControllerMethod() == 'addcategory') $Sender->View = 'views/categories/add.php'; }
Try that?
Note: I just made this up, if it doesn't work we can try something else.
Vanilla Forums COO [GitHub, Twitter, About.me]
[/web/forum/library/core/class.pluggable.php:192] Gdn_Dispatcher->xApplication(); [/web/forum/library/core/class.pluggable.php:192] Gdn_Pluggable->__call(); [/web/forum/library/core/class.pluggable.php:192] Gdn_Dispatcher->Application(); [/web/forum/library/core/class.pluggable.php:192] Gdn_Pluggable->__call(); ... and so on
/themes/ThemeName/views/categories/add.php
If anybody else got any ides let me know.