Bulk log in users with SSO?


(Rob Jeffrey) #1

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


(Jay Pfaffman) #2

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.


(Rob Jeffrey) #3

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


(Simon Cossar) #4

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: wp-discourse/utilities.php at master · discourse/wp-discourse · GitHub.

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


(Rob Jeffrey) #5

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