I’d like to automatically apply certain badges to users in certain groups. In searching the forum, it appears this may be possible via SQL queries, etc. We are on the hosted plan, so that is not possible. In talking with Discourse support, it appears a solution might be to make an app/script that uses the API to apply the badge to users in a groups. Two questions with this:
Has someone done this already and would be willing to share?
How would I implement an app/script that uses the API within the hosted forum setup?
@sam Gotcha. What do you think is the better option though? Is it dangerous to begin making SQL queries from within the hosted platform? Makes me a bit nervous because there are other admins in our account and I worry if they accidentally do something in the currently hidden SQL area, it could seriously mess up our database.
@scombs, I had posted in another thread, and someone responded almost at the same time. The code is slightly different. Do you know what the difference would be?
main difference is: gu. vs g.
Other poster’s code:
SELECT gu.user_id, gu.created_at AS granted_at, null AS post_id
FROM group_users AS gu
WHERE gu.group_id = ( SELECT id FROM groups WHERE name ilike 'InsertTheTeamNameHere' )
is there any practical difference?
I’m a complete novice at this, and I just want to give the site owner the code to copy/paste so he doesn’t have to modify it at all.
btw, the group name we are using is: Confirmed_ST_User
여기서 참고사항을 하나 덧붙입니다. Standard 또는 Business 호스팅 플랜을 사용하는 사이트에서는 더 이상 커스텀 배지 SQL을 활성화할 수 없습니다. 커스텀 배지를 만들 수는 있지만, 배지를 수동으로 부여하거나 Discourse API를 통해 부여해야 합니다. API를 통해 배지를 부여하는 방법에 대한 자세한 내용은 다음 링크에서 확인하실 수 있습니다: Grant a custom badge through the API.