Bulk log in users with SSO?

Hello all,

I have a site with SSO between discourse and WordPress. I have a few hundred users on the WordPress side and I want to get them into the discourse system without having to make them log into discourse first to activate the SSO link or my self having to log in manually to each one before handing it over the user.

Is there a way to bulk log in or edit users?

Many Thanks,

Rob

There are topics describing how to configure sso such that users are logged in to Discourse when they log in to wordpress. They will need to log in to wordpress again after they do that, though.

I don’t know that there’s a way to figure out who has logged in to sso and then get them logged in to Discourse.

Thanks Jay for your reply, yes I have it configured at the moment (users are logged in to Discourse when they log in to wordpress)

The user accounts I want to get into discourse without manually logging each of them in are all fresh accounts I have created but i need to hand them to the user with them already being in the discourse system so I can set them up with the correct bio, badges and groups.

Thanks again Jay

If you are using the WP Discourse plugin, you can probably accomplish this by writing a script that loops through the users you have created and calls

WPDiscourse\Utilities\Utilities::add_user_to_discourse_group( $user_id, $group_names )

for each of the user IDs. See: https://github.com/discourse/wp-discourse/blob/master/lib/utilities.php#L309.

There is also a sync_sso_record function in that file that could be useful.

4 Likes

Thanks Simon! I will give this a go but it sounds exactly what I need

1 Like