Forum Discussion

ann_eav's avatar
5 years ago

Custom Badges - badge criteria for date events

Hi everyone!

We are creating some new custom badges to improve our gamification and we have found out with an issue. I hope that someone can help us to find a workaround or to report it as a bug.

We want to create a badge with this criteria:

If the user logs into the community on a specified day of the year, the user gains the badge. Examples: pi day, programmers day, Christmas...

To achieve this, the criteria I was using was:

example: cake day badge:

signin_date >= '2021-2-17'

But I can see here a problem because if I go live with this badge, I won't be able to update the formula because live badges are unable to perform this action. So this badge won't be possible to win in 2022.

Looking through the documentation I can't find a solution to match login date by day and month but not for a year.

https://community.khoros.com/t5/Badges/About-badge-rules-and-supported-badge-criteria/ta-p/117227

How can I achieve this action? Do someone has this type of gamification? How did you achieve this?

Thanks

  • Hi ann_eav,

    Badge rules are pretty limited, despite the seemingly large list of options.

    We did a badge for Star Wars day (May the Fourth) and used this date formula:
    signin_date >= '2020-05-04T00:00:00' AND signin_date < '2020-05-04T23:59:59'

    If we use the same badge again next year, I'll disable global notifications for a minute and grant the badge to users with a particular role- in this case the role will be for those who got the badge in 2020. Notifications will be disabled briefly so there's no confusion on the "new" award. A new badge for the 2021 date will be created and we'll repeat.

    Until there's a better solution, I hope this helps.

    -Drew

  • What cblown said is what we are in the middle of doing ourselves. For badges earned outside of Khoros, we are using custom profile attributes to assign these via the API (Example: Once a user earns a certification in our learning system, we write to a khoros custom profile attribute the value of 'True', which in turn gets picked up by the badge logic to assign the certification badge)

    I'm now trying to decide how crazy we take this, and if we do the bulk data/write back values into custom profile attributes to allow us to trigger off more data points. It seems crazy to have to pull data out of Khoros only to push it right back in, but that's the only option in some cases 😞

    • ann_eav's avatar
      ann_eav
      Ace

      Hi StanGromer, thanks for your reply. 

      The logic that you are describing is very interesting. 🙂

      Could you tell me the API call to retrieve the users custom attributes? we have asked for the creation of two fields but I can't find the API call to retrieve data of the profile of a user.

      • StanGromer's avatar
        StanGromer
        Boss

        ann_eav eg: SELECT c_custom_badge_103 FROM users WHERE id = 10

        *Note the "c_" - We had custom attribute called "custom_badge_103" created, but they automatically add the c_ onto them.

        Admittedly, it was a lot of back and forth w/ support to get everything working (I don't think a lot of Khoros customers are doing stuff like this) - 

         

  • Hi ann_eav,

    Badge rules are pretty limited, despite the seemingly large list of options.

    We did a badge for Star Wars day (May the Fourth) and used this date formula:
    signin_date >= '2020-05-04T00:00:00' AND signin_date < '2020-05-04T23:59:59'

    If we use the same badge again next year, I'll disable global notifications for a minute and grant the badge to users with a particular role- in this case the role will be for those who got the badge in 2020. Notifications will be disabled briefly so there's no confusion on the "new" award. A new badge for the 2021 date will be created and we'll repeat.

    Until there's a better solution, I hope this helps.

    -Drew

    • ann_eav's avatar
      ann_eav
      Ace

      Hi Drew_C 

      I think that this solution is very clever! However, I see that maybe you could win the badge two times if you have sign-in in 2021, maybe the new badge created should have a mix of having the role OR sign-in in the date? 

      I know that this is possible but I have never tried it before. If this works, every year a little maintenance would have to be done:

      - Extract the users that have the badge.

      - add them all to the role. Disable the notifications.

      - Delete the badge, and create a new one that checks for the role or the sign-in in the new year.

      - Repeat every year.

      And that way the users would be going to the role eventually and the badge would not be repeated.

       

      However, I really hope that an easier workaround could be found...

       

      Thanks again for the response. Let's see if we can find something more efficient and if not I will mark your answer as the solution!

      • Drew_C's avatar
        Drew_C
        Boss

        However, I see that maybe you could win the badge two times if you have sign-in in 2021, maybe the new badge created should have a mix of having the role OR sign-in in the date? I know that this is possible but I have never tried it before.

        That's a good point and I'm not sure how I want to handle that yet. I tried combining the role OR date, but there was a problem with that- now I can't remember if it showed up as an invalid formula or if it just didn't work.

        Either way, the automatic badge award options look nice, but don't really play nice when you want to get creative.