Update group membership using external database

Would it be possible to create a private category usable only by a custom group and synchronise membership of that group with an external database?

I’m considering creating a category on a public forum for a mirror of a private mailing list. Not everyone on one would be on the other. For this to work, Discourse (or a separate script) would need to add and remove existing Discourse users to and from the custom group based on who is from time to time a member of the email list.

Thanks.

1 Like

This should be possible using WordPress as the SSO provider for Discourse. You’ll have to install and configure WordPress, and see Managing Discourse group membership with WP Discourse SSO for the other details.

2 Likes

In that case, I would need to install Wordpress solely as a bridge between Mailman and Discourse. I am sure I could sync users between Mailman and Wordpress. But it would be a sledgehammer to crack a nut.

Are they any more direct ways?

Thanks.

1 Like

Hmm, not sure. Maybe @simon has some ideas?

1 Like

I’ve just had a look at the Discourse API documentation page. It’s possible to get a list of users (which contains usernames), get user by username (which contains the user’s groups), add user to group, and remove user from group. I guess I could run a cron job regularly to ensure only current Mailman list subscribers are members of the Discourse private group.

Has this been done already?

Something API solution like that is what I would recommend. I’m not aware of a mailman-to-discourse solution. If you’re running the mailman server, you could add hooks there to add/remove people from the Discourse group when their subscription status changes, but a daily cronjob that syncs them is probably easier and nearly as effective. Depending on how many subscribers and churn rate, you could also be even more low-tech and just let people request access to the group or contrive to Invite individual users to a group.

2 Likes

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