Undo an Official Warning

When moderator sends a warning and it turns out that user shouldn’t have got it, the moderator would like to reverse this warning.

This warning will need to be removed through the console. If you are a hosted customer, you will need reach out to the Discourse team to have them handle this for you.

Warnings are in the user_warnings table. If the warning you want to delete is the last warning that was created on your site, you can do that with:

UserWarning.last.destroy

If the warning wasn’t the last warning, you can find the warning by searching for user_warnings by user_id:

UserWarning.where(user_id: the_user_id)

This will give you an array of warnings for that user. You can then destroy the warning by using the warning’s id . For example:

UserWarning.find(3).destroy

Destroying the warning will leave the PM in place. The PM will no longer be a warning.

Last edited by @JammyDodger 2024-05-28T14:25:26Z

Check documentPerform check on document:
18 Likes

Is there any chance you could share the steps that I’d need to take to log in to the Console? I’ve tried Googling this but every guide seems to assume that the user will know how to do that.

Assuming you followed the standard installation guide, you would SSH into the server and run:

cd /var/discourse/
./launcher enter app
rails console
3 Likes

Hey @JammyDodger . Maybe there needs to be a magic link that links “console” and/or “rails” (or maybe “rails console”) to

2 Likes

Hmm. That’s an idea. :thinking: I’ve been burnt with these before though. :slight_smile:

Let me keep an eye out now you’ve said it and see how often it comes up. :+1:


We are going through the docs at the minute, so maybe in this case it would good to add the full instructions in the guide.

3 Likes

Or maybe the section will be “stuff you can do in rails” and the About or whatever will be enough.

Surely it’d be much easier to handle these as penalties and have a log of all official warnings sent for administrators and moderators to manage at any given time? It makes it very difficult when a moderator accidentally warns a user with a similar name and then has to reach out to the site maintainer for them to resolve the problem.

1 Like

I think there’s a feature request for it here:

2 Likes