# Granting Manual Badges

**URL:** https://meta.discourse.org/t/granting-manual-badges/70847
**Category:** Support
**Created:** [September 27, 2017, 3:24am UTC](https://meta.discourse.org/t/granting-manual-badges/70847 "2017-09-27T03:24:33Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Kwan](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@David\_Kwan](https://meta.discourse.org/u/David_Kwan)
#### Post date: [September 27, 2017, 3:24am UTC](https://meta.discourse.org/t/granting-manual-badges/70847/1 "2017-09-27T03:24:33Z")

</div>

Is the only way to grant manual badges to go into a user’s profile and add them? Is there a quicker way (ex: a place where you can see a list of users and click to add the same badge to more than one of them)?

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [September 27, 2017, 4:57am UTC](https://meta.discourse.org/t/granting-manual-badges/70847/2 "2017-09-27T04:57:25Z")

</div>

There is a _similar_ feature request that’s #pr-welcome; it’s actually been on my list of things that I want to try to implement.

> [@Improved badge granting workflow](https://meta.discourse.org/t/feature-proposal-improved-badge-granting-workflow/58631/3):
>
> I totally support adding a “wrench” option for “grant badge” here: [image] I think the workflow should be consistent. Click Grant Badge… Select Badge Badge is granted to user and attributed to post#pr-welcome

Not sure about mass badge-granting though. What’s your use case here? Could `group`s be leveraged?

---

<div class="post-metadata">

### Author: ![David\_Kwan](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@David\_Kwan](https://meta.discourse.org/u/David_Kwan)
#### Post date: [September 27, 2017, 9:00pm UTC](https://meta.discourse.org/t/granting-manual-badges/70847/3 "2017-09-27T21:00:04Z")

</div>

Thanks for the heads up! My use case is that we have a website that allows teachers to build assignments, collect live student insights (like a Google Doc), and easily track student growth. We are using Discourse primarily as a place where they can learn and collaborate together. As such, we are using the badging system to award learning and collaborative achievements as shown on our badging page ([http://discuss.goformative.com/badges:](http://discuss.goformative.com/badges:)). The majority of the badges there are new since the behaviors necessary to earn them are specific to our purpose. With that, it’s going to be really inefficient if we need to click into a user profile to award a a badge manually. I am looking for a better way to do this.

You mentioned Groups. How could groups be leveraged?

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [September 27, 2017, 10:10pm UTC](https://meta.discourse.org/t/granting-manual-badges/70847/4 "2017-09-27T22:10:40Z")

</div>

Really nice custom badges you have there!

> [@David\_Kwan](#):
>
> You mentioned Groups. How could groups be leveraged?

Since it’s possible to [bulk add users to a group](https://meta.discourse.org/t/bulk-add-to-group/34979), you could then: [Grant a badge for all members of a group](https://meta.discourse.org/t/automatically-grant-a-badge-for-all-members-of-a-group/18147)

* * *

Alternatively, if you are comfortable enough with Ruby, you could write and execute a Ruby script in your production environment, along the lines of:

```ruby
# or you can lookup users by username/email
users = User.find_by(id: [1, 2, 3, ..])

# 100 is the id of the badge
badge = Badge.find(100)

users.find_each { |user| BadgeGranter.grant(badge, user) }

```

* * *

From a long term perspective, I think maintaining and granting badges on a regular basis will do?

---

<div class="post-metadata">

### Author: ![David\_Kwan](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@David\_Kwan](https://meta.discourse.org/u/David_Kwan)
#### Post date: [September 27, 2017, 10:36pm UTC](https://meta.discourse.org/t/granting-manual-badges/70847/5 "2017-09-27T22:36:34Z")

</div>

Thanks for the kind words and ideas! I think I will probably just end up going with the Group one and creating groups for different badges and bulk adding users to those groups at the end of the day!

---

<div class="post-metadata">

### Author: ![jcoates](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jcoates/32/78029_2.png) [@jcoates](https://meta.discourse.org/u/jcoates)
#### Post date: [September 28, 2017, 1:40am UTC](https://meta.discourse.org/t/granting-manual-badges/70847/6 "2017-09-28T01:40:12Z")

</div>

You could modify Sam’s bug reporter badge code.

> [@What is the bug reporter badge?](https://meta.discourse.org/t/what-is-this-bug-reporter-badge/17987/24):
>
> Bug Reporter SELECT distinct p.user\_id, p.created\_at granted\_at, p.id post\_id FROM badge\_posts p JOIN topics t ON t.id = p.topic\_id JOIN post\_actions pa ON pa.post\_id = p.id AND post\_action\_type\_id = ( SELECT id FROM post\_action\_types WHERE name\_key = 'like' ) AND pa.user\_id IN ( SELECT gu.user\_id FROM group\_users gu WHERE gu.group\_id = ( SELECT id FROM groups WHERE name ilike 'team' ) ) WHERE category\_id = ( SELECT…

Basically, you pick a category, and grant a badge to any user who posts a topic liked by your staff. You can then award badges as easily as hitting the like button.

You could concevably do this with a different badge for every category on your site.

---

<div class="post-metadata">

### Author: ![jcoates](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jcoates/32/78029_2.png) [@jcoates](https://meta.discourse.org/u/jcoates)
#### Post date: [September 28, 2017, 2:23am UTC](https://meta.discourse.org/t/granting-manual-badges/70847/8 "2017-09-28T02:23:20Z")

</div>

They can have a category for outside events where event hosts can start a topic about their events. Then staff can just like the outside event topics to grant badges. They could even tag the various kinds of events by tagging the post then have a custom SQL to grant different badges based on the topic tag.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 25, 2019, 12:18am UTC](https://meta.discourse.org/t/granting-manual-badges/70847/9 "2019-10-25T00:18:34Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [July 6, 2023, 3:53pm UTC](https://meta.discourse.org/t/granting-manual-badges/70847/10 "2023-07-06T15:53:37Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [July 6, 2023, 10:05pm UTC](https://meta.discourse.org/t/granting-manual-badges/70847/11 "2023-07-06T22:05:49Z")

</div>

Just a little update on this, but you can Bulk Award a badge to a group of people now using a CSV:

 ![bulk award badges](https://global.discourse-cdn.com/meta/original/4X/5/3/4/534a16820e77c0bc9bdca8da4b51236b5accd6e3.png)

More info in [Bulk Award a badge to a set of users](https://meta.discourse.org/t/bulk-award-a-badge-to-a-set-of-users/138694)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [July 6, 2023, 10:05pm UTC](https://meta.discourse.org/t/granting-manual-badges/70847/12 "2023-07-06T22:05:53Z")

</div>


