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.

Yaga LeaderBoardModule - Render on Recent Discussions page in Panel (not on Activity page)

r0obertr0obert
edited October 2014 in Vanilla 2.0 - 2.8

Vanilla v2.1.3 and Yaga v1.0, fresh install, bootstrap theme.

I managed to only partially make it show on the main page (just All Time Leaders) by adding this to Bootstrap/views/default.master.tpl:

{module name="LeaderBoardModule"}

How can I also add the This Weeks Leaders, as seen on the Activity Page by default?

Thanks in advance!

Comments

  • peregrineperegrine MVP
    edited October 2014

    why not make a plugin with this in it.

         public function DiscussionsController_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);
              $Module = new LeaderBoardModule();
              $Sender->AddModule($Module);
            }
          }
    
          private function _AddResources($Sender) {
            $Sender->AddCssFile('reactions.css', 'yaga');
          }
    

    I don't know what it will do to performance to have it do the sql lookups on home page.
    If it were me I'd consider leaving it just on activity page.

    Be interesting to hear what hgtonight says.

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

  • hgtonighthgtonight ∞ · New Moderator

    Hmm... I should have added the type to the constructor. Then you could have done something in your tpl files like {module name="LeaderBoardModule" timespan="w"}.

    @peregrine‌'s snippet will make it look just like the current activity panel leader boards.

    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.

  • Yup, thanks hgtonight, that workd perfectly. If anyone wants crystal clear instructions on how to insert a Yaga LeaderBoardModule, I found this:

    https://blog.vanillaforums.com/help/vanilla-forums-friday-theme-tip-adding-leaderboard/

Sign In or Register to comment.