It might be possible to test the concept by using a Data Explorer 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.
-- string :group_name
WITH target_users AS (
user_id AS master_user_id
FROM group_users gu
JOIN groups g
ON g.id = gu.group_id
WHERE g.name = :group_name
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:
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:
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.