What if I was to enable WordPress as a Discourse Client and then create an automation script that will:
Impersonate a user account on Discourse so that the automation is logged in as the user
Navigate to Wordpress and click “Login with Discourse” button.
repeat for all users that exist on Discourse. Around 2k
The idea is that step # 2 will force WP to create an account for the Discourse user with the same credentials. I am also assuming that the “Login with Discourse” button will work automatically without asking for a password when I am logged in as the user, impersonating them.
Once I do this will all users, their accounts would exist inside WP and then I can switch WP to Discourse Provider?
It seems like it makes sense in theory, but would love to hear your feedback on if this could work.
OK. Then if you have Discourse users in WordPress, then you will need to make all of those users have an account in WordPress. If they create it with the same email address, they should be connected with their Discourse user when they log in.
After configuring WordPress as the DiscourseConnect provider, Discourse users who do not yet have accounts on your WordPress site will need to signup on WordPress before they can access your Discourse site. You should add a message to your Discourse site to tell users about the change. In the message, encourage users to signup on WordPress with the same email address as they are using on Discourse. That way they will be logged into their existing Discourse account the first time they log back into Discourse via WordPress.
If users do not register on WordPress with the email address they are using on Discourse, a new account will be created for them the first time they log back into Discourse via WordPress. You can resolve this issue on a case by case basis by merging the old Discourse account into the new Discourse account. This can be done from the user’s Discourse admin page.
One thing to note is that the behaviour of users being logged into their existing Discourse account will only work if email addresses are being marked as “valid” on the WordPress end. If you are using the default WordPress registration system, this will work without any issues. If you are using a custom registration page that has been added by a plugin, it is likely that users email addresses will not be marked as “valid.” Details about how to resolve this issue are here: Configure single sign-on (SSO) with WP Discourse and DiscourseConnect. Note that it is very important that you don’t just blindly accept email addresses without validating them in some way. If email addresses are not validated, you risk having existing accounts taken over.
It looks like you are using the default WordPress registration system. I am assuming that because your login page is at wp-login.php. This means that the WP Discourse plugin will mark user’s email addresses as verified.
Yes, Discourse will still send them emails. Email notifications sent from Discourse are not affected by using Discourse Connect as the authentication system.
A user on your WordPress site who has never accessed Discourse is not considered to be a user on Discourse. They will not receive any email notifications from Discourse. The only exception to this is if you enable the WP Discourse “Create or Sync Discourse Users on Login” setting:
If that setting is enabled, a Discourse account will be automatically created for users when they login to your WordPress site. In that case, if a user has logged into WordPress, but never visited your Discourse site, they will start receiving the weekly digest email from your Discourse site.
You can confirm whether or not email addresses are being verified by creating a new account on WordPress after having enabled Discourse Connect. If email addresses are verified, you will see a confirmation at the bottom of the user’s preferences page. You can also manually mark an email address as verified from here:
Assuming email addresses are not being verified, instructions for how to have email addresses marked as verified when a user creates an account are here: Configure single sign-on (SSO) with WP Discourse and DiscourseConnect. This would be safe to do if your site is sending users a confirmation email that contains a link they need to click before they can access the site. If your WordPress site isn’t doing that, you could also add some code so that user’s email addresses are marked as verified after they have registered for one of your courses. Setting that up might require some help from a developer.
The easiest thing to do would be to sort this out so that there is only one login page on the site, and the page contains a valid link to the site’s registration page. I suspect that can be accomplished via the settings page of the plugin that is adding the login form. Note that if you choose to use the login page at https://projectvanlife.com/login/ , you will need to add /login to the “Path to your Login Page” in the WP Discourse settings:
I think this might confuse users. An easier approach would be to just add a link to your Discourse forum that is structured so that users are automatically logged into Discourse when they click the link. Here are details about how to create the link: Create a DiscourseConnect login link. Once DiscourseConnect is enabled on your site, you should also structure this link in that way:
That is possible. Some details about how to do it are here: How to import Discourse users to WordPress? - #2 by simon. The main problem I see is that you’d be creating work for yourself without making things much easier for your users. If it was me, my concerns would be that users might not get or read the email and some users might not be happy about having a new account created on their behalf. There’s also a potential security issue unless the importer plugin you use has a way of forcing users to change their passwords after their first login.
It would be a lot easier to just create a banner topic in your “staff” category with details about the change. The wording in the screenshot could be improved a bit:
Once you’ve made the change, update the banner topic to let users know to contact an admin if they run into any issues logging in.
I just thought of something that might help. You could temporarily configure your Discourse site to be the DiscourseConnect provider for your website between now and the time that you set your WordPress site to be the DiscourseConnect provider. If you did that, you could add something like the following to the banner topic:
<a href="http://wp-discourse.test/?discourse_sso=1&redirect_to=http://wp-discourse.test/wp-admin/profile.php" target="_blank">Create an account on (your website name)</a>
Clicking it will register a new account on WordPress and redirect users to their WordPress profile page where they can set a password. Note that for your case you will need to replace both uses of http://wp-discourse.test in the link with https://projectvanlife.com/
Technically, what it does is make a call to the Discourse sync_sso route and passed their data (WordPress user_id, username, name, email…) to Discourse immediately after they login to WordPress. Details about the sync_sso route are here: Sync DiscourseConnect user data with the sync_sso route.
The only side effect of this that I’m aware of for WordPress users who have never visited the Discourse site is that they will start receiving digest emails from Discourse.
This is why you want to encourage your Discourse users to register on WordPress with the same email address as they are using on Discourse. As long as the email addresses match, they will be logged into the correct Discourse account. This is assuming you take care of the issue with email verification that we discussed in previous posts.
It’s likely that you’re going to end up with some users signing up on WordPress with different email addresses than they’ve used on Discourse. For that case, a new Discourse account will get created for them, using the WordPress email address. You’ll need to manually merge the old Discourse account into the new Discourse account: Merge User Accounts.
Updating a user from their WordPress profile page doesn’t trigger the call to sync_sso. It probably should do that though. For now, you’ll need to ask them to log out of WordPress, then log back into WordPress. I don’t believe it’s possible for an admin to logout a WordPress user from their profile page.
If you want to keep emails and/or usernames synced between WordPress and Discourse, enable these Discourse settings: