HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to not display a module
nithish
New
Comments
If you simply do not want to show it, and ask for the simplest solution, using CSS and display:none would be the answer.
The module will nevertheless be built and the html will be transferred to the client. So if you are searching for a way to avoid that, you need some PHP code => a themehooksfile or a plugin
The DiscussionFilterModule is a Module in the Panel which is an Asset (just like the Head, the Content and the Foot). Vanillas Gdn_Controller class has a property "Assets" which is an array with the four assets mentioned above. Each module that is added to an asset wiv the addModule() method is just another key in that array. So the trick is to unset Gdn::controller()->Assets['Panel']['DiscussionFilterModule']. You can basically do that at any time after the module has been added (which is done in the constructor of the Gdn_Controller).
Before each of the assets is rendered, an event is thrown (in Gdn_Controller->renderAsset()). That's where I would do it.
On the other hand, that event is fired 4 times (for each asset). Maybe it would be more efficient to put that one line into
base_render_before
If it should only be excluded from the Discussions page, make it
discussionsController_render_before
Thank you very much for the detailed explanation!!