Find previously suspended users

Is it possible to get a list of users who were suspended at one time or another (not neccessarily actively suspended)?

I think you can use this in the data explorer plugin

SELECT * FROM user_histories
  WHERE action = 10

I’m validating that 10 is suspended, but I believe it is.

And I found it is
https://github.com/discourse/discourse/blob/74f22f95da49709d6ec09eca8f23645c9ac7bc16/app/models/user_history.rb#L19-L29

3 Likes

OK, can it be done by a Moderator? To the best of my knowledge mods don’t have access to run queries.

No, it can’t. But if you give it to your Admin, they can create the query, and you could use a master API key to access the queried data

1 Like

Thanks @cpradio, this is less of an issue after I discovered that suspensions are logged…but no names are stored in logs. I would rather see a fix to that then need to bother the admins:

Is that still the case @jomaxro?

I doubt it. That was 3 years ago, and the linked bug was fixed/closed. Will check to be sure.

2 Likes

Suspensions are definitely logged now, checked both /admin/logs/staff_action_logs and the downloaded CSV. Found a separate bug, but I’ll open a new topic for that.

4 Likes