# Anonymizing Users in Discourse

**URL:** https://meta.discourse.org/t/anonymizing-users-in-discourse/86929
**Category:** Announcements
**Tags:** new-feature, anonymization
**Created:** [May 7, 2018, 3:13pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929 "2018-05-07T15:13:31Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [May 7, 2018, 3:13pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/1 "2018-05-07T15:13:31Z")

</div>

If you want to **permanently remove** a user from your community, but also preserve their contributions to Discourse, you can _anonymize_ that user.

### How do I anonymize a user?

At the bottom of a user’s admin page, there is an “Anonymize User” button:

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/6/262089f80d48091cb22a08911a0136f28b6c64e9.png)

You’ll be asked to confirm. If you agree, the user will be anonymized.

### How thorough is the anonymization?

- The user will no longer be able to log in to your community as this specific account.

- A new username will be randomly assigned to the user such as `anon123456`. This new username will be applied to all their posts in the system, and we will update all `@mentions` and quotes too.

- The new username is not applied to: deleted posts, post revisions _when the current post doesn’t mention or quote the renamed user anymore_, oneboxed user profiles, queued posts, or staff logs.

- Their email, name, date of birth and avatar will be removed. Their password will be replaced with a secure, random password.

- In the case where site settings have been configured to require a name, the name will be set to the same, anonymized username, e.g. `anon123456`.

- Their user profile will be removed.

- Any api keys generated for the user will be revoked.

- Any third party authentication mechanisms (Google/Facebook/etc) will be revoked.

### IP History

Discourse will retain the user’s IP addresses in our logs associated with the anonymous user. However, there is a new mechanism to clear those out too available to developers.

When using our `UserAnonymizer` class, you [can pass in an :anonymize\_ip](https://github.com/discourse/discourse/blob/05dddcb2fd1756b31d50648a8a4ea5b7b50b6f1d/app/services/user_anonymizer.rb#L33) option with an IP to replace, for example `0.0.0.0`.

If provided, Discourse will go through several tables in our system and update the IPs associated with the anonymous user to the new value.

If you’d like to enable this feature on your Discourse, we recommend creating a plugin to handle your particular workflow.

### User Deletion

New users can _self delete_ their own accounts, provided

- the account is 🆕 new and was created within a few days
- the account hasn’t posted more than once

If you sign up for an account and regret it, you can leave at will – provided you haven’t posted very much, and decide within a few days of joining.

### GDPR

The new [GDPR](https://ico.org.uk/for-organisations/guide-to-the-general-data-protection-regulation-gdpr/) regulations came into effect in Europe in 2018, specifically the [Right of Erasure](https://ico.org.uk/for-organisations/guide-to-the-general-data-protection-regulation-gdpr/individual-rights/right-to-erasure/).

The anonymization tools in Discourse are available to all administrators, but **we recommend you contact a legal professional if you require GDPR compliance**. Said professional will be able to audit your systems and tell you if you meet the requirements.

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [May 7, 2018, 6:12pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/2 "2018-05-07T18:12:54Z")

</div>

> [@eviltrout](#):
>
> A new username will be randomly assigned to the user such as `anon123456` . This new username will be applied to all their posts in the system, and we will update all `@mentions` and quotes too.

Just tested on try.  
In the quotes the username is anonymized but not the avatar (see [Do you use a mobile device for ALL your work? Tell me how! - #6 - tech - Discourse Demo](https://try.discourse.org/t/do-you-use-a-mobile-device-for-all-your-work-tell-me-how/25/6?u=dax)).  
As an administrator instead, every time I tested this function making an anonymous user, when I click the back button of the browser twice to return from the user’s admin page to the topic I was reading I always end up on page 404.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [May 7, 2018, 6:31pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/3 "2018-05-07T18:31:16Z")

</div>

> [@dax](#):
>
> In the quotes the username is anonymized but not the avatar

Will be fixed soon.

> [@dax](#):
>
> when I click the back button of the browser twice to return from the user’s admin page to the topic I was reading I always end up on page 404.

Well, that error is to be expected. You visited the user’s profile page before you anonymized the user and that page is still in the browser history.

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [May 7, 2018, 6:37pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/4 "2018-05-07T18:37:37Z")

</div>

> [@gerhard](#):
>
> Will be fixed soon.

😍

> [@gerhard](#):
>
> Well, that error is to be expected.

That’s true, because Discourse try go back to the original admin user page, which is no longer available, then reload the admin user page of the anonymous user, the second click on the back button would like to return to the `original-user/summary` page that no longer exists and you go to page 404 instead.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 1, 2019, 4:46pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/8 "2019-06-01T16:46:30Z")

</div>

No, you can’t undo this anonymizing.

You can restore a backup made before the destructive action.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [August 21, 2023, 3:17pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/11 "2023-08-21T15:17:05Z")

</div>

2 posts were split to a new topic: [Is it possible to pass anonymize\_ip parameter via http api call to /admin/users/{id}/anonymize method?](https://meta.discourse.org/t/is-it-possible-to-pass-anonymize-ip-parameter-via-http-api-call-to-admin-users-id-anonymize-method/276051)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [August 21, 2023, 3:15pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/22 "2023-08-21T15:15:07Z")

</div>

4 posts were split to a new topic: [Why can’t non-developers admin reset the IP field of anonymized accounts?](https://meta.discourse.org/t/why-cant-non-developers-admin-reset-the-ip-field-of-anonymized-accounts/276050)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [August 21, 2023, 3:02pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/26 "2023-08-21T15:02:50Z")

</div>

7 posts were split to a new topic: [Anonymizing a user leaves mentions of them as their original username](https://meta.discourse.org/t/anonymizing-a-user-leaves-mentions-of-them-as-their-original-username/276045)

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [September 17, 2023, 4:10am UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/63 "2023-09-17T04:10:13Z")

</div>

> [@Falco](#):
>
> No, you can’t undo this anonymizing

I have figured a way to do so manually but is not a full restore. Manually restoring anonymized user name and re attaching user’s email. Then sending reactivation email.

A headache for sure and hopefully no one be sides someone like myself will ever need to do so. 😉

---

<div class="post-metadata">

### Author: ![SvenIJK](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@SvenIJK](https://meta.discourse.org/u/SvenIJK)
#### Post date: [December 11, 2024, 2:13pm UTC](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929/64 "2024-12-11T14:13:58Z")

</div>

I created a plugin for Discourse where also the IP address is anonymized  
[https://github.com/ijkbv/discourse-plugin-anonymize-user](https://github.com/ijkbv/discourse-plugin-anonymize-user)  
For future users who don’t want a headache
