# How to prevent user deletion if it has posts

**URL:** https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392
**Category:** Support
**Created:** [December 18, 2019, 12:04pm UTC](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392 "2019-12-18T12:04:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![carlosjcabello](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carlosjcabello/32/160234_2.png) [@carlosjcabello](https://meta.discourse.org/u/carlosjcabello)
#### Post date: [December 18, 2019, 12:04pm UTC](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392/1 "2019-12-18T12:04:40Z")

</div>

Hi,

I’ve created this topic because I don’t fully understand how the user deletion process works.

I thought that it was not possible to delete a user if it had posts. It seems there is even an informative message for this on the user page in the Admin panel:

> Users can’t be deleted if they have posts. Delete all posts before trying to delete a user.

See for instance these related topics that mention that message:

- [Documentation on the process for deleting users?](https://meta.discourse.org/t/documentation-on-the-process-for-deleting-users/88659)

- [Deleting all posts by a user](https://meta.discourse.org/t/deleting-all-posts-by-a-user/126222)

However, I don’t see it in my forum (see image below) and I was able to delete a user with posts via the “Delete User” button as a moderator.

 ![Screenshot 2019-12-18 at 12.37.46](https://global.discourse-cdn.com/meta/original/3X/e/e/eee076edba90bced0b7c26f423fd725eb845933d.png)

Therefore, I would like to know how I can prevent staff members from deleting users with posts and get the informative message displayed. Is there any setting that I missed?

Thanks,  
Carlos

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [December 18, 2019, 1:00pm UTC](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392/2 "2019-12-18T13:00:15Z")

</div>

Hey Carlos 👋

> [@carlosjcabello](#):
>
> I thought that it was not possible to delete a user if it had posts

This is correct, but it’s a little bit more nuanced than it seems.

You cannot delete users who have posts older than the limit set in the `delete_user_max_post_age` site setting on your site. That setting defaults to 60 days.

So it works like this:

If the oldest post the user you’re trying to delete is 59 days old, you can delete that user. Deleting them will automatically delete all of their posts.

If it’s older than 60 days, you cannot delete the user. You would have to delete all of their posts first before deleting them. You actually won’t even see the delete button. You’ll see the message you mentioned in your post

> Users can’t be deleted if they have posts. Delete all posts before trying to delete a user.

until you delete all of their posts.

If the defaults don’t work for you - like, say for example, you don’t want your moderators to delete anyone with posts older than 10 days - then you can change the `delete_user_max_post_age` setting on your site to match your needs.

---

<div class="post-metadata">

### Author: ![carlosjcabello](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carlosjcabello/32/160234_2.png) [@carlosjcabello](https://meta.discourse.org/u/carlosjcabello)
#### Post date: [December 18, 2019, 2:31pm UTC](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392/3 "2019-12-18T14:31:52Z")

</div>

Thank you for the information and for clarifying this matter 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [January 17, 2020, 2:40pm UTC](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392/4 "2020-01-17T14:40:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
