HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Side-bar Panel [Categories, Recent Discussion, Activity]

MokieeMokiee New
edited May 2015 in Vanilla 2.0 - 2.8

Hello everyone, I am so new here in vanilla forums. So, Let me direct to the topic.
The three links in side-bar panel which are the "Categories, Recent Discussion and Activity".
I want to remove them in that particular panel. So, I've search it and I found some codes (answers).
I am wondering, where do I put the codes given by individuals?
I am using the latest version of the forum.

Here's some codes I found when searching.

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

Any idea? I want to remove it because I think that links are useless.
Idk what you think about those three links.
Any answer is much appreciated. Thank you!

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Those modules may also contain other links link to your drafts and to your discussions and to the participated discussions via the use of other plugins which put a link there.

    My suggestion is to hide the specific links you don't want to see using css rules.

    hgtonight
  • R_JR_J Ex-Fanboy Munich Admin

    In order to put that anywhere you either need a custom theme or a plugin.

    Custom theme: http://vanillaforums.org/discussion/comment/225254/#Comment_225254

    hgtonight
  • I am using a Bootstrap theme.
    My question, where do i put the code?

  • R_JR_J Ex-Fanboy Munich Admin

    Don't just take a quick look and ask again because your question is not exactly answered. You can (easily) find the answer in the link from above. Try again and if you really cannot make it, tell us where you got stuck

  • No, I need to know where to put the code i posted on this discussion (the code above). At the html code (index.php)?

  • R_JR_J Ex-Fanboy Munich Admin

    Question over there:
    What I must do foe redefine modules views? Please, take me examples.

    Answer over there:
    When you create a new theme, create also a file \themes\YourFancyTheme\class.themehooks.php with following code:

    <?php defined("APPLICATION") or die;
    class YourFancyThemeThemeHooks implements Gdn_IPlugin {
        // this two functions do nothing here, but you need to implement them!    
        public function setup () {
            return true;
        }
        public function onDisable () {
            return true;
        }
    
        // this will be called on every page
        public function base_render_before ($sender) {
            // don't show categories
            unset($sender->Assets['Panel']['CategoriesModule']);
        }
    
        // only done when looking at a discussion
        public function discussionController_render_before ($sender) {
            // don't show the In this Discussion module
            unset($sender->Assets['Panel']['InThisDiscussionModule']);
        }
    }
    

    Question here:

    I am wondering, where do I put the codes given by individuals?
    public function PageController_Render_Before($Sender) {
    unset($Sender->Assets['Panel']['DiscussionsModule']);
    unset($Sender->Assets['Panel']['RecentActivityModule']);
    }

    How often do you count: unset($sender->Assets['Panel']... - that can be no coincidence! So the code I've pointed you to looks very similar, but there is some more in the quotation above. It tells you what you have to do:
    "create also a file \themes\YourFancyTheme\class.themehooks.php with following code:"

    You are using bootstrap? You might try to create a file called \themes\Bootstrap\class.themehooks.php.
    And now look at the code above: it should be changed according to your needs:

    <?php defined("APPLICATION") or die;
      class BootstrapThemeHooks implements Gdn_IPlugin {
        // this two functions do nothing here, but you need to implement them!
        public function setup () {
          return true;
        }
        public function onDisable () {
          return true;
        }
    
        public function PageController_Render_Before($Sender) {
          unset($Sender->Assets['Panel']['DiscussionsModule']);
          unset($Sender->Assets['Panel']['RecentActivityModule']);
        }
      }
    

    You might ask: "WHAT?! Is it really that easy?! o.O "
    Me: "Yes."
    You: "Man, that was ridiculously easy - I could have easily done that by myself!"
    Me: "Yes."

    Mokieehgtonight
  • MokieeMokiee New
    edited May 2015
Sign In or Register to comment.