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

Gamification Addon

I am using the YAGA Gamification Add-on and I just noticed that although you can award Karma points for ranks, badges and reactions, the YAGA add-on has its own separate points system as well. It shows points in my profile '+ points 24' and it shows a leader board with points ranking for weekly and all time leaders.

My confusion and suggestion is to use karma points instead of using a separate points system for YAGA because it adds confusion. Wouldn't it be better to just add or subtract karma points instead of having a separate points system? Right now I can give karma points for ranks/badges/reactions using the Karma bank plugin, but it seems a bit redundant to have a dual point system. Why not just use karma points for everything?

Tagged:
«1

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Simply put, they provide different mechanisms that are both called points.

    Yaga aims to provide gamification features giving users points based on specific actions. These points are purely cosmetic.

    Karma Bank aims to provide a transactional currency used to purchase other things.

    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.

  • One suggestion is hide points. When points are given you could reward karma.

    Karma goes down as well as up. Points tend to just go up.

    grep is your friend.

    hgtonightokhawaja
  • Another strange thing I ran into is that Reactions don't appear on thread post. I first encountered this when I unchecked "Use Reactions" in settings and then I checked "Use Reactions".....Now reactions in a post just aren't appearing on desktop or mobile.

  • hgtonighthgtonight ∞ · New Moderator

    Keep in mind that you can never react to your own content.

    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.

  • @hgtonight said:
    Keep in mind that you can never react to your own content.

    I made a post from one account and viewed it from a different account and still no reactions.

  • hgtonighthgtonight ∞ · New Moderator

    Are you using a custom theme?

    If so, try using the default theme for testing.

    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.

  • I'm using Bittersweet.

  • hgtonighthgtonight ∞ · New Moderator

    This is probably a permissions issue.

    What permissions do you have set for your member roles?

    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.

  • @hgtonight said:
    This is probably a permissions issue.

    What permissions do you have set for your member roles?

    I just had Add, View...I checked Manage and now it appears.....You're a Vanilla Boss @hgtonight

  • Is there any sort of Garden command I can use to check if use is viewing on mobile, and if so then don't attach the Leadership module?

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    I love Vanilla for the verbose namings of variables and methods.

    What would be a good way to check if someone is using mobile? isOnMobile? No search results for that in the source.
    Maybe a little shorter than that isMobile. WHOA! There it is...

    Where (i.e. how!) is the leaderboard added? It is added at numerous places and always like that:

    $Module = new LeaderBoardModule();
    $this->AddModule($Module); // or
    $Sender->AddModule($Module); // which makes no differences
    

    A quick glance shows that it isn't attached conditionally in any way and you cannot take influence on the methods when it is attached. Therefore you have to influence the method that attaches it.

    It is added with the addModule() method which seems to be a method of the controller.

    Now its time for you, Holmes.
    a) find out how to do "something" whenever a module is added
    b) restrict this whatever-action to only be done when the LeaderBoardModule is added
    c) find out what addModule "does" with the module (hint: it all comes down to adding something to an array)
    d) since you wouldn't be able to prevent the change, revert it
    e) only do this when on mobile


  • okhawajaokhawaja New
    edited June 2016

    I got it! @R_J

    I went to yaga/settings/class.hooks.php and I added this:

    public function DiscussionsController_Render_Before($Sender) {

    if (!IsMobile()) {
    $this->AddResources($Sender);

      // add leaderboard modules to the activity page
      $Module = new LeaderBoardModule();
      $Module->SlotType = 'w';
      $Sender->AddModule($Module);
      $Module = new LeaderBoardModule();
      $Sender->AddModule($Module);
    
                 }
    

    }

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    If this is what you end up with when reading my comments, I stop talking to you immediately. And believe me, you will be thankful as soon as you understand what I'm not getting tired of telling you:

    DON'T EDIT CORE FILES - NEVER!!!!!

    Go through my last comment, read it carefully and make a plugin that does exactly the same as your bad and ugly hack. Otherwise I will not give you any more hints since you obviously ignore the most important part of what I'm telling you and this will lead you into serious trouble.


  • :( I thought by core files you meant all the files outside the theme and plugins folder......I didn't know those are considered core files too...

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Don't edit. Create.


  • I thought all files/folders that don't come in the default vanilla .zip file are non-core files. Yaga application doesn't come with the default .zip file, so I thought that's not a core file either.....How do you know what's not a core file and how do you add changes if you can't even edit the files? Just by adding your own plugins and hooks?

  • brb then.....I'll create a plugin that does this same change but with the proper way...

  • okhawajaokhawaja New
    edited June 2016

    Ok.....I've read the plugin part of documentation and came up with this, haven't tried it yet, but it should work, no? It said in documentation I can override methods in core files by declaring/creating those methods in my plugin.

    I took the code from addModule method and added the if statement to check if it's LeaderBoardModule and if it's mobile. I also tried to figure out how to hook into the event BeforeAddModule to do the same thing below, but overriding the method seemed easier because I'm a bit confused by the syntax.

    class MyPlugin extends GDN_Plugin() {

    public function addModule($Module, $AssetTarget = '') {
    $this->fireEvent('BeforeAddModule');
    $AssetModule = $Module;

        if ($Module=='LeaderBoardModule' && IsMobile())
        {
        //do nothing
    
        }
    
        else
        {
        //if not LeaderBoardModule and not on mobile then continue adding the module
        if (!is_object($AssetModule)) {
            if (property_exists($this, $Module) && is_object($this->$Module)) {
                $AssetModule = $this->$Module;
            } else {
                $ModuleClassExists = class_exists($Module);
                if ($ModuleClassExists) {
                    // Make sure that the class implements Gdn_IModule
                    $ReflectionClass = new ReflectionClass($Module);
                    if ($ReflectionClass->implementsInterface("Gdn_IModule")) {
                        $AssetModule = new $Module($this);
                    }
                }
            }
        }
        if (is_object($AssetModule)) {
            $AssetTarget = ($AssetTarget == '' ? $AssetModule->assetTarget() : $AssetTarget);
            // echo '<div>adding: '.get_class($AssetModule).' ('.(property_exists($AssetModule, 'HtmlId') ? $AssetModule->HtmlId : '').') to '.$AssetTarget.' <textarea>'.$AssetModule->ToString().'</textarea></div>';
            $this->addAsset($AssetTarget, $AssetModule, $AssetModule->name());
        }
        $this->fireEvent('AfterAddModule');
    }
    
    }
    

    }

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited June 2016

    some corrections for when you don't want something to load in a mobile device taken from my plugin FootBox, remember that a "controller" is another name for page and it is where the stuff gets rendered to be seen as html ...

      public function DiscussionsController_Render_Before($Sender) {
       if(IsMobile()){
     return; //this makes it not load for mobile
    }
    else
    {
    $Sender->AddCssFile('plugins/FootBox/design/footbox.css');
    $FootBoxModule = new FootBoxModule($Sender);
          $Sender->AddModule($FootBoxModule);
    
      }
    }
    
    okhawaja
  • @vrijvlinder said:
    some corrections for when you don't want something to load in a mobile device taken from my plugin FootBox, remember that a "controller" is another name for page and it is where the stuff gets rendered to be seen as html ...


    public function DiscussionsController_Render_Before($Sender) {
    if(IsMobile()){
    return; //this makes it not load for mobile
    }
    else
    {
    $Sender->AddCssFile('plugins/FootBox/design/footbox.css');
    $FootBoxModule = new FootBoxModule($Sender);
    $Sender->AddModule($FootBoxModule);

    }
    }

    Does this mean you can put that method code in your plugin and it will append the code you have above into the discussion controller? Or will this become the only code your method will have, overriding the existing code in that method?

Sign In or Register to comment.