HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[Tutorial] How to change the order of modules and menu items
vrijvlinder
MVP
To change the sort order of Modules like the who's online or categories etc. By adding the module or changing where it is
You would add these lines to your config.php
**Organizing Module Sort Order** You can organize the order that modules appear in assets by manipulating the Modules collection of the Configuration array. Take a look at conf/config-defaults.php to see the default sort order of core-packaged modules: // Modules $Configuration['Modules']['Vanilla']['Panel'] = array('NewDiscussionModule', 'GuestModule', 'Ads'); $Configuration['Modules']['Vanilla']['Content'] = array('Gdn_MessageModule', 'Notices', 'Content', 'Ads'); $Configuration['Modules']['Garden']['Content'] = array('Gdn_MessageModule', 'Notices', 'Content', 'Ads'); $Configuration['Modules']['Conversations']['Content'] = array('Gdn_MessageModule', 'Notices', 'Content', 'Ads');
To Sort the menu Items you would need to add the line below to the config.php however keep in mind that some plugins may also be sorting the menu items or modules and you would need to adjust them too.
$Configuration['Garden']['Menu']['Sort'] = array('NewDiscussion','User','Dashboard','Privacy', etc.....);
Thanks to peregrine for handing me this resource
11
Comments
yes , its for people who don't read the official vanilla documentation, but where should this info be posted for people who don't read documentation, tutorials, wiki, or the forum lol, or should it be col
http://vanillaforums.org/docs/modules
let's not forget:
changing profile tab order
$Configuration['Garden']['ProfileTabOrder'] = array('Votes','Comments', 'Discussions');
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
In DashBoard - A few fields sort out - not all.
$Configuration['Garden']['DashboardMenu']['Sort'] = array("Import","Users","Appearance");
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Can one change the order in other places than the config.php. What if you want a plugin, when enabled, to modify the order of the panel for example?
You can read and write to the config easily:
@R_J, how does one discover the string you are using to specify what asset to manage? i.e. Garden.DashboardMenu.Sort? Is there a list of these somewhere?
It is just the config setting already mentioned by peregrine:
All you have to do is to change it to a dot-separated string => 'Garden.DashboardMenu.Sort'
Plugins can read the config and even save back to it. To read the config option @peregrine mentioned, you would use
C('Garden.DashboardMenu.Sort');
. To save a value back to that config option, you would useSaveToConfig('Garden.DashboardMenu.Sort', $Value);
.Using these in tandem in the setup method would let you modify the sort order on enable. Something like this:
EDIT - Cross posted. @R_J is just too awesome
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Okay, so this
$Configuration['Modules']['Vanilla']['Panel']
would be
'Modules.Vanilla.Panel'
?
Yup. The periods denote a sub array.
I think this is emulating some functionality found in JS, aka The Lord's Language.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Well I've got this working writing to the config file, but it's not changing the order. What ends up getting written to config.php is:
But that doesn't seem to effect the order. If I manually enter this:
Then it works.
Here's the code I'm using in the plugin:
After:
Do a print_r or var_dump or any debugging option that Vanilla / Garden gives to see what's the contents of $ModuleSort
If that gives you a normal array (not serialized) then look in the function SaveToConfig() why it is serializing before wriying to the conf/config.php file
There was an error rendering this rich post.
It is serializing the array in SaveToConfig. This is expected behavior. The unexpected behavior is in class.controller.php. It doesn't retrieve the configuration values directly, but through the modules parent array. This means it does not unserialize the array stored there.
This is a pickle and fixing it may cause unintended consequences.
You may be able to get a reference and bypassing the SaveToConfig method all together, but I have a feeling that won't help.
I think a bug report is in order.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
And how does one make a bug report??
Although we would love for you to find out yourself by ... reading the announcement for the Vanilla Beta version ... we would point you in the right direction if it would take too long for you to find out...
Let's see if you can find the issue list on the Vanilla Github repo
There was an error rendering this rich post.
you can also sort the menu items like this and override the config, possibly the same approach can be taken for the modules...I use this in my PrivacyNotice plugin to force the link to be the last on the list so the popup can be applied properly.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
if you look for issues in underdog's signature and click on the links - that is one way to go there.
Other than that - documentation page in vanilla and wiki have info on issuetracker
and the announcement as underdog already mentioned.
the key to all the semantics is "bug report" can be also called issues or "issue tracker".
we need a tutorial on synonyms and vanilla jargon.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
other related discussion:
http://vanillaforums.org/discussion/25574/v2-0-18-8-moving-the-profile-page-s-about-box-to-the-top-above-edit-profile-new-user#latest
http://vanillaforums.org/discussion/20636/can-the-navigation-menu-items-be-reordered
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.