Import Existing Wordpress Users into Discourse

Hey all,

Maybe I am missing something, but how do I achieve the following?

Existing Wordpress site containing hundreds of registered members.
New Discourse self hosted installation using Wordpress as SSO provider.

I need to import all of the existing Wordpress Users into Discourse so that they don’t need to first login to the Wordpress site in order to gain access to the Discourse notifications.

These users are NOT tech savvy and asking them to first login to the website is just too complex for them.

They are currently used to using a Google Groups noticeboard system that they can communicate with posts purely via email. Thus they will not reliably self provision within the new hosted Discourse.

Any ideas would be greatly appreciated.

Are you trying to migrate users to Discourse or to Discord?

If you are using WordPress as the SSO provider for Discourse with the WP Discourse plugin, enabling the Create or Sync Discourse Users on Login option should accomplish what you are looking for. Discourse users will be created from WordPress users when they first login to your WordPress site.

@simon Discourse sorry.

I have that option enabled, but I don’t want the users to HAVE to login in order to be created in Discourse.
Due to the users technical ineptitude, I need to mass import them into Discourse without any interaction from them.

The VAST majority of the users will never actually login. However they WILL participate in conversations via email replies.

1 Like

There are a few ways you could approach it. If you are ok with doing some programming, there are some static functions that the WP Discourse plugin makes available for sites that are using WordPress as the SSO provider for Discourse. The functions are in this file: https://github.com/discourse/wp-discourse/blob/master/lib/utilities.php.

To use them, you would need to loop through all your WordPress users and for each user call:

$sso_params = \WPDiscourse\Utilities\Utilities::get_sso_params( $user );

\WPDiscourse\Utilities\Utilities::sync_sso_record( $sso_params );

The $user parameter in the first line should be a WordPress user object.

You will need to be aware of Discourse rate limiting. You’ll want to limit your requests to about one request per second. When the call to sync_sso_record is successful, a Discourse user will be returned.

1 Like

Awesome thanks. And if I am not confident with a bit of programming?

1 Like

What I posted above might be the easiest way to get your existing users into WordPress. If you have a budget, you could create a topic in our #marketplace category to find someone to do the work for you.

If you don’t have a budget, you could plead with your users to login to your WordPress site. If you have a lot of users who are never going to login to WordPress or Discourse, you might need to re-think your approach.

Thanks @simon.
I have posted in the #marketplace.

Thanks for your assistance.

1 Like

Depending on your situation, the easiest thing to do would be to not use SSO to log users into Discourse. Then you could just export a list of users from WordPress, extract their email addresses into a CSV file, and use the Discourse bulk invite functionality to invite them to your forum. You could customize the invite email to let users know that they need to click the link in the email and agree to join the community. Once they’ve done that, they are free to interact with it by email.

3 Likes

Sounds like what you should do is do an import of the existing data. Can you get mbox files of the list?