How do i turn off delete option?

hi! i dont want to give users the option to delete their content. is there a way to remove delete button for users, but keep it only for admins? thank you.

To prevent users from deleting posts, you can use the max post deletions per day or the max post deletions per minute site setting.

3 Likes

Hi,

thank you for your quick response. I have set both these to 0. still i’m able to delete a post i created as a normal user.

Did you try to delete the first post of a topic or a reply?

I just tested this and it is working as expected. make sure you are using a non-staff user account.

It will let my test user edit but not delete, even right after posting.

2 Likes

oh i tried deleting first post.

yes, i was testing with non-staff account. but i tried deleting topic. and topic got deleted right away. this option is restricted to only replies?

I was able to delete my topic as a normal user.
Maybe there is a bug, because the behavior seems strange

1 Like

thank you for testing this. previously, it deleted all the contents, but not the topic. It didn’t let me (normal user) to delete topic. The last evening, it deleted the entire topic and redirected me to the home page.

@Discourse is this a bug?

Ok I’ve been testing this and checked with one of our developer managers, and confirmed it is by design and not a bug. A topic post can be deleted if in the first 24 hours after creation, but only before someone else replies. If a reply is posted, topic cannot be deleted and a modal pops up.

The second OR clause there, is_my_own?(topic) && topic.posts_count <= 1 && topic.created_at && topic.created_at > 24.hours.ago does NOT use a specific site setting. Thus, users can delete their own topic regardless of the post_deletions site settings within the first 24 hours of creation (and before someone else replies).

This is the pop up message if a reply is posted to the topic trying to be deleted
image

Keep in mind that users deleting content is soft deletion. Staff can still see the topics and restore them if necessary. All deleted topics on your forum can be found by admins and mods at https://your-forum-url/latest?status=deleted.

3 Likes

Then I would expect that the user is also able to undelete their post within 24 hours. But that sees impossible when max post deletions per day and the max post deletions per minute are set to 0. Discourse still shows the trash instead of the undo icon.

Maximum number of posts a user can delete per minute / day. Set to 0 to disable post deletions.

And maybe the description of the settings should say something like “replies” instead of “posts”. For example, min post length affects all posts - first posts and replies, even though there is a separate min first post length setting.

1 Like