Forum Discussion
Thanks for sharing the code. I'm also curious which page you added this component on. Header? Certain board/topic? or user profile?
Also it feels like there are many unneccessary role assignment calls in here. e.g. if a user has 32 solutions on a board all the if clauses for the "lower" unlocks will trigger as well:
<#if (userSolutions >= 10) && has_Sol_board2_10 == "false"> <#assign result = restadmin("/roles/name/has_Sol_board2_10/users/add?role.user=id/${user.id}") /></#if>
No? Or will selfRole.name return correctly for user profiles with multiple roles?
- PerBonomi10 years agoBoss
Claudius wrote:Thanks for sharing the code. I'm also curious which page you added this component on. Header? Certain board/topic? or user profile?
Also it feels like there are many unneccessary role assignment calls in here. e.g. if a user has 32 solutions on a board all the if clauses for the "lower" unlocks will trigger as well:
<#if (userSolutions >= 10) && has_Sol_board2_10 == "false"> <#assign result = restadmin("/roles/name/has_Sol_board2_10/users/add?role.user=id/${user.id}") /></#if>
No? Or will selfRole.name return correctly for user profiles with multiple roles?
I think the header is the only good place, to make sure it runs in all the relevant boards. It should be fairly low-bandwidth because there are no rest calls to check if it should run or not.
On your second point, technically yes, but I think it's the only way to make sure users who've been around for a while still get the early badges. Could probably skip some of it if the script were live from the start of the community. From what I've seen selfRole.name works correctly.
We also give users badges for reaching x total badges, so I want to be sure folks get the early badges too.
Is that what you meant?
Related Content
- 9 months ago
- 9 months ago
- 9 months ago
- 7 months ago