Adding members to groups via CSV

AI-generated summary

Adding members to groups via CSV

The discussion revolves around the ability to mass-add users to groups in Discourse via CSV. Joey_Tuan initially requests this feature, citing their use case of separating members into patients and researchers. codinghorror suggests using a batch invite howto, but Joey_Tuan points out that the “send invites” button is gone after switching to SSO. codinghorror recommends writing API calls to set groups for SSO users. Alternatively, watchmanmonitor shares a script that imports existing users via CSV. myronb asks for help on using this script in a Docker environment.

I recall that there was a way to mass-invite people to the site by copying and pasting a CSV.
I want to do the same thing for groups, but instead I have to manually enter one username at a time.

My use case is that I’m trying to separate our discourse members into patients & researchers. On our main site, we track which members are researchers, and they use SSO to log onto discourse. Thus it would be very straighttforward for us to do a nightly copy-and-paste of usernames that should be placed in the Researchers group.

Would it be possible to add this feature?

Yes, there is a howto here on sending batch invites.. just follow that. If the email already exists on the site, they will just be granted whatever new group membership that invite specifies.

The problem is that after switching to SSO, the “send invites” button is now gone. I was a huge fan of the bulk invite feature.

I think you would need to write API calls to set the groups on your SSO users.

oh - this script works on existing users too (assuming you have access to the container via docker)

https://github.com/vindia/discourse_user_importer

Thank you! Would you mind telling me how to import a csv file into lib/tasks in docker?
After launcher enter app, where should I go?