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.
Options

Module SlotType

Vanilla: Version 2.1.5 / Yaga Version 1.0.3

I'm attempting to load the leaderboard module on the panel of every page.

I've added:

          {if !InSection ("ActivityList")}
          {module name="LeaderBoardModule" SlotType="w"}
          {/if}

Tip was taken from this post: http://blog.vanillaforums.com/help/vanilla-forums-friday-theme-tip-adding-leaderboard/

It works but only loads the All Time Leaders, which as I understood is only supposed to work with an "a" SlotType. I'm mostly interested in it working with "m" as monthly seemed better for smaller (and slower) communities.

Emptying the cache had no effect. Any ideas?

Comments

  • Options
    peregrineperegrine MVP
    edited December 2014
    you want it on the Activity Controller - try this 
    
        public function ActivityController_Render_Before($Sender) {
        $this->_AddResources($Sender);
        if(C('Yaga.LeaderBoard.Enabled', FALSE)) {
        // add leaderboard modules to the activity page
        $Module = new LeaderBoardModule();
        $Module->GetData('w');
        $Sender->AddModule($Module);
        }
    

    http://vanillaforums.org/discussion/28180/yaga-leaderboardmodule-render-on-recent-discussions-page-in-panel-not-on-activity-page#latest

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

  • Options
    hgtonighthgtonight ∞ · New Moderator

    Thanks for using my addon!

    Yaga has similar but not identical functionality. The leaderboard module I wrote does not accept constructor variables to set type. I rely on calling a second GetData($SlotType) method after creation.

    This means my module cannot be added via smarty as anything other than 'All Time Leaders'.

    I would welcome a patch that changes this and will add it to the issue list over on GitHub: https://github.com/hgtonight/Application-Yaga/issues/52

    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.

  • Options

    Thank you, it works in a plugin nicely, switching to a DiscussionsController places it on Recent Discussions, but not on any other page (particularly would like it on ItemDiscussions too.) I tried Base_Render but we've got it everywhere now, and thus dupes itself on Activity.

  • Options
    peregrineperegrine MVP
    edited December 2014

    you could either

    • A
      clone the DiscussionsController method and add DiscussionController as well

    or you could

    • B

          public function Base_Render_Before($Sender) { 
      
          $Controller = $Sender->ControllerName;
      
            // show module on these 3 controllers
           $ShowOnController = array(
                          'discussioncontroller',
                          'discussionscontroller',
                          'categoriescontroller'
                         );
      
           if (!InArrayI($Controller, $ShowOnController))
                           return;
          $this->_AddResources($Sender);
          if(C('Yaga.LeaderBoard.Enabled', FALSE)) {
      
          $Module = new LeaderBoardModule();
          $Module->GetData('w');
          $Sender->AddModule($Module);
      
            }
      

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

  • Options

    Perfection, added categoriescontroller too, and learned a bit along the way. Thanks for the help!

Sign In or Register to comment.