How do I add lots of users to a group efficiently?

To follow up on this; When I have hundreds of users and create a new group and want to assign a lot of them to that group (too many to do manually for each one), how can I select and assign multiple users at a time? I would have thought there would be checkboxes so one could select multiple users in the list or something like that.

If you are operating on hundreds of users at the moment the most efficient way to deal with it would be to use the API.

Checkboxes on a list of users is not something we implemented, the use case of going from 0 to a group of 800 users is a bit painful via the UI now, what you can do though is allow people to join the group themselves and just make the group self service which can save time.


Well, I see what you’re saying, but if you need to put users into groups very rarely, then writing code to use the API is hardly any more efficient.

Consider if you have say 200 users and you want to assign 190 of them to a group. You could then easily select all users with the “select all” feature, then uncheck the 10 that you don’t want, and hit “assign to group” or something.

But obviously this doesn’t work when you cannot select multiple users and assign them to groups.

Allowing people to join is unfortunately not the same as putting them into the group (e.g. for my use case, which is assigning them their own category which only this group has access to).

I guess the conclusion is that you cannot easily assign many users to a group. Not without writing code or using the API some other way.

If you want to do it lots of times going forward you want the API, if it’s part of a migration then you could use the Rails console or an import script.

If it’s something that you’ll do forever and there’s some trigger that would add them to the group, then you might use a plugin.

Oh, look! I wrote a GitHub - pfaffman/discourse-user-creator: Create an activated user, optionally assigning to group. I don’t know if it works, but it probably does. You could conceivably modify it to just add to groups. If you would like help modifying it and have a budget, my contact info is in my profile.

1 Like

I think there is a legitimate feature request here for the: page. Like the search and the topic list page we should have a bulk selection tool there that allows you to select a bunch of users and operate on the. (delete, add staff note, set trust level, add to group, adjust watching state, and so on)

Not specifically on our road map, but an interesting idea @codinghorror


If you only plan on doing this from time to time, you could “Bulk Add to Group.”

Admin > Groups > Groupname

To get a list of users to manipulate, you can export them from Discourse first:

Admin > Users > Export


Thanks @omarfilip, I’m marking this as the reply as it’s the closest to a solution, and not that bad of a workaround honestly.

Thanks to you other guys as well!

1 Like

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