Custom Sidebar Panel
I may have totally missed this but I feel like I have been searching for hours. How can I customize the sidebar panel. I noticed that on this forum you have a My Profile box. I would like to do something similar. What file must I modify?
Tagged:
0
Comments
Vanilla Forums COO [GitHub, Twitter, About.me]
If by "whole plugin" you mean 1 file called default.php with one method called Base_Render_Before() containing maybe 3 lines of code to include the module... then yes. A whole plugin
Vanilla Forums COO [GitHub, Twitter, About.me]
Dashboard > Messages
Vanilla Forums COO [GitHub, Twitter, About.me]
All I want to do is add the login form that appears on http://support.bavotasan.com/vanilla/entry/signin to the sidebar panel on the index page where the welcome box is. I would like to have it there instead of appear in the popup. I would also like to do something similar to the My Profile box that is on this site.
Thanks.
$Configuration['Modules']['Vanilla']['Panel'] = array('NewDiscussionModule', 'SignedInModule', 'GuestModule', 'Ads');
Vanilla Forums COO [GitHub, Twitter, About.me]
http://vanillaforums.org/discussion/12861/how-do-i-put-a-google-advertisement-in-the-right-sidebar
True, changing `$Configuration['Modules']['Vanilla']['Panel']` doesn't affect the order and display of modules in the panel asset...
Bug?
It has worked some versions ago, so I'd say it is a bug. In the Gdn_Controller there is the following property:
/** * @var string An associative array of assets and what order their modules should be rendered in. * You can set module sort orders in the config using Modules.ModuleSortContainer.AssetName. * @example $Configuration['Modules']['Vanilla']['Panel'] = array('CategoryModule', 'NewDiscussionModule'); */ public $ModuleSortContainer;The inline documentation suggests that this is the way to achieve a sort, but later on you can find this code:
public function __construct() { ... $this->ModuleSortContainer = ''; ... }And it is not filled anywhere with values from the config before it is used:
public function getAsset($assetName) { if (!array_key_exists($assetName, $this->Assets)) { return ''; } if (!is_array($this->Assets[$assetName])) { return $this->Assets[$assetName]; } // Include the module sort $modules = array_change_key_case(c('Modules', [])); $sortContainer = strtolower($this->ModuleSortContainer); $applicationName = strtolower($this->Application); if ($this->ModuleSortContainer === false) { $moduleSort = false; // no sort wanted } elseif (isset($modules[$sortContainer][$assetName])) { $moduleSort = $modules[$sortContainer][$assetName]; // explicit sort } elseif (isset($modules[$applicationName][$assetName])) { $moduleSort = $modules[$applicationName][$assetName]; // application default sort }Since the
$this->ModuleSortContaineris always an empty string, the last if condition will always match and no sort will happen.To fix this, adding this to your theme/a plugin should recreate the sort method again:
public function base_render_before($sender) { $sender->ModuleSortContainer = Gdn::config('Modules.Vanilla.Panel'); }