# Add Badge to Solve answer

**URL:** https://meta.discourse.org/t/add-badge-to-solve-answer/79126
**Category:** Feature
**Tags:** solved
**Created:** [January 26, 2018, 10:56pm UTC](https://meta.discourse.org/t/add-badge-to-solve-answer/79126 "2018-01-26T22:56:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://meta.discourse.org/u/chi)
#### Post date: [January 26, 2018, 10:56pm UTC](https://meta.discourse.org/t/add-badge-to-solve-answer/79126/1 "2018-01-26T22:56:41Z")

</div>

Based on this post and screenshot, there is a way to add a badge to solve answers. - [Discourse Solved](https://meta.discourse.org/t/discourse-solved-accepted-answer-plugin/30155)

But on the latest plugin, no option is available. How do I add or associate a badge to solve answers now?

Thanks!

 ![10%20AM](https://global.discourse-cdn.com/meta/original/3X/b/3/b3e1035a5099bde70ee98baa7909f1448d141fab.png)

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [January 26, 2018, 11:05pm UTC](https://meta.discourse.org/t/add-badge-to-solve-answer/79126/2 "2018-01-26T23:05:22Z")

</div>

Are you talking of this query?

```plaintext
SELECT p.user_id, p.id post_id, p.updated_at granted_at
FROM badge_posts p
WHERE p.post_number > 1 AND 
    p.id IN (
      SELECT post_id FROM (
       SELECT pc.post_id, row_number() 
       OVER (PARTITION BY p1.user_id ORDER BY pc.created_at) as rnum
       FROM post_custom_fields pc
       JOIN badge_posts p1 ON p1.id = pc.post_id
       JOIN topics t1 ON p1.topic_id = t1.id
       WHERE name = 'is_accepted_answer' AND
                     value IS NOT NULL AND
                    p1.user_id <> t1.user_id AND 
        (
          :backfill OR 
           p1.user_id IN (
                   select user_id from posts where p1.id IN (:post_ids)
           )
       )
) X WHERE rnum = 1)

```

You need to follow this topic: [Enable Badge SQL](https://meta.discourse.org/t/badge-sql-can-no-longer-be-edited-by-default/47894)  
Then create a new badge in `your-site.com/admin/badges`

---

<div class="post-metadata">

### Author: ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://meta.discourse.org/u/chi)
#### Post date: [January 26, 2018, 11:15pm UTC](https://meta.discourse.org/t/add-badge-to-solve-answer/79126/3 "2018-01-26T23:15:45Z")

</div>

Thanks @dax.

If I’m correct, once I enabled the creation a new bad, I can just add this code and no need to check something on the plugin to enable it?

OLD example of the plugin-solved:  
 ![46%20AM](https://global.discourse-cdn.com/meta/original/3X/e/b/eb088bd2fa277622c25582a4c6d92ea6a10a3985.png)

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [January 26, 2018, 11:21pm UTC](https://meta.discourse.org/t/add-badge-to-solve-answer/79126/4 "2018-01-26T23:21:09Z")

</div>

> [@chi](#):
>
> If I’m correct, once I enabled the creation a new bad, I can just add this code and no need to check something on the plugin to enable it?

`Allow badges to be awarded in this category` does not refer to the solved plugin in particular, but to all the Discourse badges in general. You do not have to check anything, just that the plugin is enabled globally or on the individual categories as @awesomerobot explained to you here [https://meta.discourse.org/t/added-latest-version-of-plugin-solved-checkbox-for-op-is-not-showing/79128/3?u=dax](https://meta.discourse.org/t/added-latest-version-of-plugin-solved-checkbox-for-op-is-not-showing/79128/3)

---

<div class="post-metadata">

### Author: ![lindsey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lindsey/32/318210_2.png) [@lindsey](https://meta.discourse.org/u/lindsey)
#### Post date: [October 28, 2025, 7:46pm UTC](https://meta.discourse.org/t/add-badge-to-solve-answer/79126/5 "2025-10-28T19:46:38Z")

</div>

I believe this was resolved by Dax’s last post.
