Export a list of people who replied to a specific topic


(Alessio Fattorini) #1

Sometimes I need to mention a specific group of people who replied to a specific topic into a new one.
That’s because I’d like to involve them into a similar discussion
image

How can I do that quickly? Is there any particular query for that?


(Jeff Atwood) #2

Why don’t you simply post in the topic, with a link to your other topic, and interested people can see and follow that link? Mentioning 26 people by @username seems a bit extreme.


(Alessio Fattorini) #3

Becuase a mention triggers a notification while just linking a topic would be overlooked
By the way, generally I don’t have so many users and I don’t mention all the people but it’s useful to have the entire list.
I know it would be useful just for “community” purpose so I asked if there is a quick way using some clever query


(Daniela) #4

There is a badge query you can modify to make it work with Data Explorer plugin


(Alessio Fattorini) #5

looks cool but I don’t have “badge_posts” table.
How can I make it work?


(Daniela) #6

You don’t need that table because you really don’t want a badge. You want a list of users that replied to a specific topic.

Probably you need the table “users”, but I’m not a query expert…


(Alessio Fattorini) #7

Done :slight_smile: and I can download via CSV

SELECT u.username
FROM badge_posts p
JOIN topics t ON p.topic_id = t.id 
JOIN users u ON p.user_id  = u.id
WHERE t.id = '1010'
GROUP BY p.user_id,u.username

#8

A little change to optimize that query (if you want to change the topic_id before execute it)

-- [params]
-- topic_id :topic_id = 18438
SELECT u.username
FROM badge_posts p
JOIN topics t ON p.topic_id = t.id 
JOIN users u ON p.user_id  = u.id
WHERE t.id = :topic_id
GROUP BY p.user_id,u.username 

Note: replace 18438 for some topic_id from your forum :blush: