# Anonymous User Groups

**URL:** https://meta.discourse.org/t/anonymous-user-groups/141466
**Category:** Support
**Created:** [February 13, 2020, 5:22am UTC](https://meta.discourse.org/t/anonymous-user-groups/141466 "2020-02-13T05:22:18Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [February 14, 2020, 3:23am UTC](https://meta.discourse.org/t/anonymous-user-groups/141466/2 "2020-02-14T03:23:57Z")

</div>

> [@arivanandan](#):
>
> I’ve never written a plugin before but it seems this can best be done with a plugin.

It might be possible to test the concept by using a [Data Explorer](https://meta.discourse.org/t/data-explorer-plugin/32566) query that returns a list of anonymous usernames that are associated with the real users who are members of given group. You could then use the Bulk Add to Group functionality to add the users to the group.

Here’s a query that will return the anonymous usernames of the real users who are members of a group. You need to supply the value of the `group_name` parameter before running the query.

```sql
--[params]
-- string :group_name

WITH target_users AS (
SELECT
user_id AS master_user_id
FROM group_users gu
JOIN groups g
ON g.id = gu.group_id
WHERE g.name = :group_name
)

SELECT
u.username
FROM target_users tu
JOIN anonymous_users au
ON au.master_user_id = tu.master_user_id
JOIN users u
ON u.id = au.user_id

```

Running the query will return results that look something like this if any members of the group have entered anonymous mode:

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/b/0b935f637e6d1a1662acafaf77d526f265f6c10a.png)

If you are not dealing with a huge number of users, you can just copy and paste the usernames into the group’s Bulk Add form:

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

> [@arivanandan](#):
>
> Are there any other implications that I am not seeing?

You need to be aware of the `anonymous account duration minutes` site setting. It sets the length of time that anonymous accounts will persist for after a user has left anonymous mode.

Another thing to consider is that this might give users the impression that anonymous users are not very anonymous. It might be worth letting people know that admins on the site have the ability to associate anonymous users with their non-anonymous account.

Note that anonymous mode is not related to what happens when you anonymize a user from their admin page. In that case, the user really is anonymous and has all identifying details removed.

I’m interested in what you are trying to accomplish, but I’m not aware of any sites that are using anonymous mode in a similar way. It might be a good idea to test this out with a small group of users and see how it goes before putting a lot of effort into developing a plugin.

---

_[View the full topic](https://meta.discourse.org/t/anonymous-user-groups/141466)._
