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.
Basic Pages - Recent Discussions shown next page
Kaspar
Moderator
Love the Basic Pages application! :-)
I wonder why 'Recent Discussions' are shown next to my page - instead of 'Categories'(as when in discussions view) or nothing is shown in the side(as in categories view)?
What did I miss / do wrong or how can I change it?
Thanks in advance.
0
Comments
Thank you for using the Basic Pages app!
Those are just the modules I decided to include on the page view. A page is a different content type than discussions on your website and the "Recent Discussions" module seems like a better fit than the "Categories" module because the categories don't relate to the filtering of pages. The "Discussion Filter" module, which displays navigation links to categories, recent discussions, and activity, is also included.
If I recall correctly, you may be able to override or modify the list of modules loaded on the PageController through an event handler in a separate addon. Alternatively, you can hide certain modules or the entire sidebar on the page view via CSS rules in your theme.
Add Pages to Vanilla with the Basic Pages app
Thank you.
I commented the below out - so I still have the filtermenu.
/basicpages/controllers/class.pagecontroller.php
Have no idea how to go about "override or modify the list of modules loaded on the PageController through an event handler in a separate addon."
For others seeking similar solution - I changed:
to
I recommend using single-line comments (//) instead if you're only commenting one line at a time as is the case within in your snippet above for convenience and readability; only use multi-line comments (/* ... */) when commenting out a multiple lines of code together.
So, what you showed is one way to remove those modules, but the problem with modifying the actual file is that updates to the Basic Pages app could replace your changes and you'd have to redo it all over again. A better way would be to unset the modules--credits to @hgtonight for posting this solution a while back--from the Panel asset in the controller via a custom plugin or theme hooks.
For example, your custom plugin can contain code like this:
I might remove the BookmarkedModule from Basic Pages in the future and leave the rest.
Add Pages to Vanilla with the Basic Pages app
It is not working for me.
I believe this is the right way now?
I tried with both.
I have:
/plugins/UnsetModules/
addon.json
class.UnsetModules.php
Tried with and without <?php - as that is not stated in the documentation you linked.
Tried with Gdn_Plugin and Gdn_Controller
Have cleared cache, plugin enables without any error in all cases.
Have tried both UnsetModules and unsetmodules for folder, file, key and class (using the later cause the plugin enable-toogle not actually visually move to be enabled - but is enabled if page is refreshed - but no error-message).
even if it worked, wouldn't unset for every page?
Thanks in advance.
Try renaming class.UnsetModules.php to class.UnsetModulesPlugin.php
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
shouldn't it be either "class.unsetmodules.plugin.php" or "UnsetModulesPlugin.php"?
@Kaspar: you might have to delete /cache/addon.php after renaming the file
Thanks to you both.
I now have the following which work (only affects the Pages pages).
/plugins/UnsetModules
addon.json
class.Unsetmodules.php
Note &$sender instead $sender
I gather I tried with &$sender - did not work
Tried $sender(removing &) - and perhaps added
at the same time - then never tried with both & and <?php in place.
(& in place but <?php removed does not work)
<?php is not mentioned in the docs - I'll file an issue about it later today.
I knew I had read somewhere that &$sender was deprecated.
https://open.vanillaforums.com/discussion/21003/fyi-for-vanilla-2-1-looks-like-sender-in-your-plugin-is-not-only-deprecated
In the code snippet Shadowdare initialy introduced here both &$sender and $sender is used - what is the difference?
Using the ampersand is a normal operator in php for referencing a variable and has nothing to do with vanilla
$a = $b
If $b has value 1, $a will have it, too. But if you make $a = 2, $b will not change
$a = &$b
Change $a and $b changes, too
&$sender
as a parameter in Vanilla's magic methods was deprecated and perhaps doesn't work that way now since it already passes itself by reference.In my example, I created the variable
$panel = &$sender->Assets['Panel'];
so we don't have to type out the full line for each module to be unset for readability. It must be assigned by reference (sometimes typed out as=&
as well) as assigning to the array directly would basically create a copy of it once something has been modified; we want to modify the original array.By the way, if you want to unset modules for a specific page, you can do this:
I haven't tested the above out yet. I just typed it out here, but it should work.
Additionally, if there were a lot of modules on the page, you could store the module names you want to unset in an array and then loop through and unset each using the value at each index. This should help keep the code clean.
Also, I think the documentation assumes that the reader has some basic knowledge of PHP. All PHP files should start with
<?php
unless you're outputting HTML first.Add Pages to Vanilla with the Basic Pages app
Giving a tiny bit back to the community :-)