Discourse Solved

:discourse2: Summary Discourse Solved allows users to accept solutions on topics in designated categories.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-solved
:open_book: Install Guide How to install plugins in Discourse

Configuration

To enable Solved on a single category:

  • Navigate to a category page and click on the category settings button

  • Navigate to the settings sections

  • scroll down and enable the Allow topic owner and staff to mark a reply as the solution setting

    image

To enable Solved on all categories:

Enable the allow solved on all topics site setting

/admin/site_settings/category/all_results?filter=allow_solved_on_all_topics

How does it work?

As the OP (topic creator), you will have a button that allows you to accept an answer.

Topics with accepted answers are highlighted and linked in the topic list:

image

Accepted answers are highlighted in the first post:

Some sites might benefit from a solved/unsolved indicator on topic lists. If that’s your cup of tea, you can enable the empty_box_on_unsolved site setting.

admin/site_settings/category/all_results?filter=empty_box_on_unsolved

image

Search

When searching for topics, you can filter the search to only solved or unsolved topics via the status:solved and status:unsolved queries. “are solved” and “are unsolved” can also be found via the “Where topics” dropdown.

Filters

You can enable a filter dropdown in topic list pages using the site setting show_filter_by_solved_status

admin/site_settings/category/all_results?filter=show_filter_by_solved_status

solved-filter

You can also filter solved/unsolved topics by adding a parameter to the URL. For example:

https://meta.discourse.org/c/support?solved=yes

or

https://meta.discourse.org/c/support?solved=no

These links could be added above a specific category list by following the instructions here

Badges

As it stands, our plugin system has no clean way of shipping badges and removing them when a plugin is removed. While this is being solved you can add badges to your liking via the badge interface.

A badge for first accepted answer:
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)
A badge for 10 accepted answers
SELECT id user_id, current_timestamp granted_at
FROM users
WHERE id  IN (
       SELECT p1.user_id 
       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 p1.user_id <> t1.user_id AND 
                    name = 'is_accepted_answer' AND 
                    value IS NOT NULL AND
            p1.user_id IN (
                   SELECT user_id 
                   FROM posts 
                   WHERE :backfill OR  p1.id IN (:post_ids)
            )
        GROUP BY p1.user_id
        HAVING COUNT(*) > 9
)

Data Explorer Queries

To list each individual “solved” event:

SELECT acting_user_id, target_topic_id, target_post_id, created_at FROM user_actions
WHERE action_type=15
ORDER BY created_at DESC

To produce a list with stats per-user: (with variable for time interval, defaults to 1 year):

-- [params]
-- string :interval = 1 year
SELECT  ua.acting_user_id, 
        count(case t.user_id when ua.acting_user_id then 1 else null end) as is_op, 
        count(case t.user_id when ua.acting_user_id then null else 1 end) as not_op,
        count(*) as total
FROM user_actions ua
LEFT JOIN topics t ON target_topic_id = t.id
WHERE action_type=15
AND ua.created_at >= CURRENT_DATE - INTERVAL :interval
GROUP BY ua.acting_user_id
ORDER BY total DESC

Original spec discussion


This is an official plugin, and we plan to ship it to all our customers. Thank you to Western Digital for funding the development of this plugin!

140 Likes
Solved Button Plugin
What is this checkbox icon in the topic list?
How do you enable a tick mark?
Mark as Solution feature?
Can't find "Allow topic owner and staff to mark a reply as the solution" Setting
Mark all topics as solved specific category
How to replace the discourse `Topic` with `Question` instead?
Pop-up message after selecting the best answer
Query to find out who marked the solution as solved
Question Answer Plugin
Image zoom is not working
Option to mark as solved
Discourse need a fork to be a Q&A software?
[Accepted answer plugin] Add an ability to accept the initial (topmost) post as a solution
No option appears to choose better answer
Titles in SVG inserted by a theme component get overwritten with page title after tab switch
Trust Level Wishlist Items
Feature: endorse button to add single-click endorsements
Send email notifications for small actions
Comment on a question instead of answering it
Discourse Data Explorer
(Ab)using bumped_at to achieve Reddit like sorting
Volunteer Activities - a simple setup for non-hierarchical collaboration
MKJ's Opinionated Discourse Deployment Configuration
Hello Community Experts- are we able to configure discussions to be threads AND questions?
Implementing KCS
Too many Crawlers, is that a problem?
Discourse instance supporting entrepreneurs who sell on Amazon
Looking for examples of Discourse Communities that visually call out answered/closed topics on feeds
Pinning a comment to the top of the comment-thread
Pinning a comment to the top of the comment-thread
Question Answer Plugin
Discourse Solved Quote Customization
Please update 'Understanding Discourse Trust Levels' — or is there a different doc?
Trust Level Permissions Table (inc Moderator Roles)
Discourse Gamification
Add Unsolved button to top menu using custom HTML
How to replace the discourse `Topic` with `Question` instead?
Answer in a post
Google Structured Data -- Invalid Article Schema
Solution icon does not show in posts
How can I fix or pin posts inside a topic
Discourse to Power Q & A Site?
Admin/mod ability to insert a post wherever
Solved plugin: post menu button now hidden at far right, used to be on the left?
Discourse for helpdesk use cases?
Introduction and question about how to best mark topics as "Answer"
Automatic Second-Post Wiki?
What cool data explorer queries have you come up with?
How can I turn discourse to Q&A based website?
Plugin: 'Ask to Answer' Mechanism
How To Mark a Topic As Resolved?
Is there any plugin for downvoting questions and replies in Discourse
Deleted posts can be counted as unread
What is SQL Badge Query for invited >25 People?
Add Badge to Solve answer
The best way to answer customers?
Badge not being applied, sql error
Generating Support Metrics (with Assign and Solved plugins)
A question re the Solved plugin and Badge SQL
Thoughts on a plugin which turns discourse into stackoverflow
Advice for getting my little game dev community "out there?"
Follow up "open" tickets
Moderating the forum