Please upgrade here. These earlier versions are no longer being updated and have security issues.

Removing the recent discussions and activity from page sidebars?

This discussion is related to the Basic Pages addon.

I've noticed that this plugin adds recent discussions and activity in the sidebar which don't work currently on my site due to the theme I'm using, I was wondering if anyone knew how to delete this? Thanks.

«1

Comments

  • hgtonighthgtonight ∞ · New Moderator

    To do it the Vanilla way, create a plugin that hooks into the controller's you don't want it to appear on and unset the modules before render. The module names you are looking for is 'DiscussionsModule' and 'RecentActivityModule'.

    To paraphrase myself:

    public function PageController_Render_Before($Sender) {
      unset($Sender->Assets['Panel']['DiscussionsModule']);
      unset($Sender->Assets['Panel']['RecentActivityModule']);
    }
    

    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.

    whu606ShadowdareDobbyr0obert
  • @Dobby, welcome to the community and thank you for using the app! @hgtonight's code should work well. Thanks for helping out, @hgtonight!

    Add Pages to Vanilla with the Basic Pages app

    hgtonightDobbyUnderDog
  • Just like to confirm that this code works perfectly, thanks a lot @hgtonight and thanks @shadowdare!

    hgtonightShadowdare
  • r0obertr0obert
    edited May 2014

    @hgtonight said:
    To do it the Vanilla way, create a plugin that hooks into the controller's you don't want it to appear on and unset the modules before render. The module names you are looking for is 'DiscussionsModule' and 'RecentActivityModule'.

    To paraphrase myself:

    public function PageController_Render_Before($Sender) {
      unset($Sender->Assets['Panel']['DiscussionsModule']);
      unset($Sender->Assets['Panel']['RecentActivityModule']);
    }
    

    @hgtonight‌ I'm not sure how to go about doing this. I want to remove the sidebar modules only on certain custom pages (created with basic pages app). I will need a conditional for this right?

    If there isn't a plugin out for this already, could you please guide me with a step-by-step instruction list?

    Thanks!

    4311021X
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited May 2014

    to every page you want to remove a module you would add the code in the head section of that page. Something like this

    <?php $this->Head->unsetAsset('SideMenuModule');?>

    You can also just use css to hide them ...

    r0obertUnderDog
  • @vrijvlinder‌ thanks! Where can I find the actual custom page that I created with basic pages app so I can edit it?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Where did you edit it to create it ?

    I would suggest you try using css to hide what you don't want

    look at the source code using a web inspector to see the name of the body

    it should look like this

    <body id="vanilla_discussion_index" class="Vanilla Discussion Index ">

    find the name of your page body then add this to your custom.css theme file

    body.Vanilla.Discussion.Index #Panel{
    display:none;
    }
    

    Obviously use the name of the page you want to affect, the above is for the discussion. So find the one you want and then create some css to hide it.

    r0obertUnderDog
  • r0obertr0obert
    edited May 2014

    I got:

    <body id="basicpages_page_index" class="BasicPages Page Index Page-testing sticky-footer-body">

    body.BasicPages.Page.Index #Panel{
    display:none;
    }
    

    didn't work...

  • r0obertr0obert
    edited May 2014

    I also tried triggering #page-sidebar (instead of #Panel), still not working. I'm not sure what I'm doing wrong here.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited May 2014

    Did you try this ? every page has an index. you need to likely add the whole thing and use :

    body.BasicPages.Page.Index.Page-testing.sticky-footer-body  #Panel{
    display:none!important;
    }
    
    UnderDog
  • r0obertr0obert
    edited May 2014

    @vrijvlinder said:
    Did you try this ? every page has an index. you need to likely add the whole thing and use :

    body.BasicPages.Page.Index.Page-testing.sticky-footer-body  #Panel{
    display:none!important;
    }
    

    Yes, I did (basically trigger the entire class name). Not working, unfortunately.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited May 2014

    If you link me then I might have a better idea...all I can say is make sure you clear the cache. But I am just guessing in the dark without a way of seeing it myself..

  • @vrijvlinder said:
    to every page you want to remove a module you would add the code in the head section of that page. Something like this

    <?php $this->Head->unsetAsset('SideMenuModule');?>

    Where do I find the testing.php file to edit? I searched but couldn't find it. I was thinking maybe I can try this method instead of css.

  • I've done it, thanks a lot for your support @vrijvlinder‌ !

    Here is the code:

    body.BasicPages.Page.Index.Page-testing.sticky-footer-body .page-sidebar{
    display:none !important;
    }
    
    vrijvlinderUnderDog
  • @Shadowdare thanks, that's awesome! All I have to do is just put that code inside a plugin right?

    Also, what's the better practice, this one or via css?

  • ShadowdareShadowdare Moderator
    edited May 2014

    @r0obert‌, that's right. The code can be placed in a plugin, application, or theme hooks file. Vanilla is very extensible in this way.

    Both the code way and the CSS way are standard ways to hide modules. It depends on what you would like to achieve. The code way removes a module from rendering on the page entirely, so if you don't want the module to load up on the page in the HTML code, this is the way to go. The CSS way is usually for stylistic purposes.

    Add Pages to Vanilla with the Basic Pages app

    r0obert
  • as an aside be aware:

    generally if something is private and you don't want someone to see something on the page, it is better to not display it in the first place via backend code (php, etc).,

    via css (display:none, etc) , just hides on the display page (on the users browser). But in firefox or in the page source people will still be able to see it if they look. and the info is still transferred from you host site to the users browser, so if you are hiding portions of a page via css, you are still sending it so it speak.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    r0obert
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    The memodule is hidden via css from the profile controllers...in the main style. So are a good many other things, which I found precisely by looking at the source code.

    If you don't want that possibility , then the best way is to not render it at all on those pages. I guess it depends on how important it is to hide it.

    r0obert
Sign In or Register to comment.