Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Badges

Try Vanilla Forums Cloud product

hgtonight · ∞ · New · Moderator

This is an activity!

About

Username
hgtonight
Joined
Visits
3,100
Last Active
Roles
Moderator, Developer, Community Developers
Points
4,761
Twitter
@hgtonight
GitHub
hgtonight
Country
United States of America
Badges
39
  • Re: The best way to prevent spam board!

    The single best thing you can do, imo, is enable Akismet anti-spam.

    plawansai
  • Re: 2 Part Question 2.3.1

    If you want to only allow sign in via SSO, you can change the register option to connect only. $Configuration['Garden']['Registration']['Method'] = 'Connect';

    Caylus
  • Re: How to add adsense vanilla 2.3.1

    Some popular addons for ads:

    Pocket - To put your adsense code

    AptAds - For more involved rotation of ads

    CategoryAds - For a simple rotating of ads per category

    whu606terabytefrelance
  • Re: Is there a way to hide/replace badges as users level up in the same category?

    @mickeybond said:
    yeah, I'm seeing that. You would need some sort of anti-badge to remove existing badges once certain criteria were met or a way to check when a new badge was earned if an older badge was no longer needed. Oh well, thanks for your help. =)

    You could do this fairly easily as a custom rule. Assuming you are talking about the Length Of Service rule, you could even extend the base rule to use the existing checking code and only remove other badges if a new one to be awarded.

    Something like:

    class HighlanderLoS extends LengthOfService
    {
      public function Award($Sender, $User, $Criteria)
      {
        if (parent::Award($Sender, $User, $Criteria))
        {
          // Get other badges using the same rule
          $BadgeAwardModel = Yaga::BadgeAwardModel();
          $Badges = $BadgeAwardModel->GetByUser($User->UserID);
          foreach($Badges as $Badge)
          {
            if($Badge->Enabled && $Badge->RuleClass == "HighlandLoS")
            {
              if (badgeIsTheBestBadge()) // you will have to implement this method
              {
                unaward($Badge, $User);
              }
            }
          }
          return true;
        }
      }
    
      // shamelessly taken from YagaUnawardBadge by @Bleistivt https://github.com/bleistivt/YagaUnawardBadge/blob/master/class.yagaunawardbadge.plugin.php
      private function unaward($badge, $user)
      {
        Gdn::sql()->delete('BadgeAward', ['BadgeAwardID' => $badge->BadgeAwardID], 1);
        Gdn::sql()
          ->update('User')
          ->set('CountBadges', 'CountBadges - 1', false)
          ->where('UserID', $badge->UserID)
          ->put();
    
        $points = Yaga::BadgeModel()->GetByID($badge->BadgeID)->AwardValue;
        Yaga::givePoints($badge->UserID, -1 * $points, 'Badge');
      }
    }
    

    This is untested and unfinished but should get you started.

    rbrahmsonR_Jmickeybond
  • Re: Tutorial: How to change wording, How to change text, How to change language. How to change locale

    This is an excellent write up!

    I just want to mention 2 things. First, you don't have to include any %s in the right side of a definition if you want to disable the "dynamic" aspect of it.

    Secondly, the /conf/locale.php file can be used regardless of your forum's language. In my mind, this is the file to change the wording of something slightly (like comments to posts in your example). So you can use it in addition to any other locale if you don't like what it says.

    peregrineRodSloan