Forum Discussion
2 Replies
I would at least upgrade it to API v2 with something like this untested code:
<#assign userData = (liql('SELECT login, user_badges FROM users WHERE id="${res.author.id}"').data.items) /> ${userData.user_badges.size}
That won't solve for having to repeatedly call this within a thread where the same author appears multiple times though. The article on caching states that it's not worth caching a users login and avatar, so following this argument it's probably not worth caching the badge count 😇
- AmanMalhotra2 years agoExpert
Hi Claudius,
In APIv1 we can get only earned badges but in APIv2 we get earned+unearned badges which are visible on the profile page and we don't have any constraint to filter unearned badges.In other words, we also get badges that users have not yet earned in APIv2 because those badges are visible on the user profile page due to the below checkbox not being checked when creating a new badge.
Screenshot: https://prnt.sc/MMbhCdIdX4oI
Related Content
- 5 years ago