Forum Discussion

Tyler's avatar
8 years ago

Recreating Badge-List Component

Hi all,

 

I'm working on recreating the Badge-List component as a custom component. I'm nearly finished, but have encountered two problems.

 

1. In Admin settings, you can make a badge "Visible" or "Hidden" to users (labeled below as "Status").

 

 

Unfortunately, I can't find where the "Status" is accessible in the V1 API. Here's the standard badge object that is returned from the API:

 

 

You'll notice that the "Status" isn't a part of the returned XML. Is the "Status" accessible at all? I can't seem to find it.

 

 

2. As an admin looking through a user's badges, I can hover over any earned badge and "Revoke" that badge. 

 

 

What sort of API call do I need to make to replicate the "Revoke" functionality? Can this be replicated?

 

 

Thanks for taking time to read through this. Any guidance would be appreciated!

  • This point will be quite hard to handle i think 

     

    The only way is to have switch case by badges & roles to make badges visible (assuming all badges a hidden by default).

    It sounds to be a very hardcoded way because there are no role-related permissions about seeing badges and badges cannot be categorized (which might be a feature request to be done).

     

    As fas as i'm concerned, the best approch would be challenging the functional need :-)

  • partial response about point 1

    If you use API v2, with a select * from users where id="x", there is a field "user_badges" which contains only visible badges.
    there is an "earned_date" field which is not null only if the badge has been earned.
    So this point is "quite" easy to handle.

    for the second point, i'm not sure there is an api call available sine this functionality is quite recent
    https://community.lithium.com/t5/Release-Notes/16-6-Release-Notes/ba-p/235982#revoke

    • Tyler's avatar
      Tyler
      Ace
      jferrandis

      Thanks for the reply! That is very useful information; I'll try that out and see how it works.
  • ClaudiusH's avatar
    ClaudiusH
    Khoros Alumni (Retired)

    Currently neither community API v1 nor v2 expose the badge visibility status nor the badge revoke feature.

    If you consider this a useful API extensions that other communities can make use of, I would recommend submitting a product enhancement idea for Lithium.

     

    Can you share why the out of the box badge components won't cut it in your scenario?

    • Tyler's avatar
      Tyler
      Ace

      The motive behind recreating the component is to add another layer of filtering viewable badges. We want certain badges to be only visible to users with certain roles and badges. 

      • jferrandis's avatar
        jferrandis
        Expert

        This point will be quite hard to handle i think 

         

        The only way is to have switch case by badges & roles to make badges visible (assuming all badges a hidden by default).

        It sounds to be a very hardcoded way because there are no role-related permissions about seeing badges and badges cannot be categorized (which might be a feature request to be done).

         

        As fas as i'm concerned, the best approch would be challenging the functional need :-)