This weekend I set up WP Discourse to bring in anyone that makes a WooCommerce purchase in as a Discourse user. I got everything to work and was super proud of myself and even set up Zapier to add them automatically to a group. But this morning someone named François made a purchase and they did not get added as a Discourse user.
I tested to make sure Chris Smith still worked. Yes.
I tested to see if Chrisç Smith would work. It doesn’t. So the c with a squiggle is causing the problem.
The user was added as a Wordpress user with a username using a normal c without a squiggle. They were not added to Discourse.
Can this be fixed or should I add them to Discourse manually? If I add them manually will their logins sync between WP and Discourse?
With SSO disabled, I am able to create a Discourse account with François as a username. I am not able to create a WordPress account with that username. The error message I get on WordPress is “This username is invalid because it uses illegal characters. Please enter a valid username.”
Are you using a plugin on your WordPress site to allow for additional characters in usernames?
I’m not using any special plugins to allow additional characters, but it did create a username for this person, just without using the special character. francois.xxx. Something changed the ç to c.
I am using WooCommerce and it’s in the WooCommerce checkout page that they enter their user info to create a login. I am requiring them to create a login.
It sounds Woocommerce strip unallowed characters from the username. Is the user with the francois.xxx username able to login to Discourse? Logging into Discourse should create an account for them.
I don’t know if they can. I don’t really want to put a new customer through that testing, but I’ll try it with my chrisç username and see what I can do. I do know that they are not being added to my user list in Discourse when they have that character in them.
You can try creating an account with a throw-away gmail address for testing this.
If you enable the “Create or Sync Discourse Users on Login” setting on the WP Discourse SSO Provider tab, Discourse accounts should be automatically created for WordPress users when the user logs into WordPress.
If you are adding users to Discourse groups via Zapier, the request will fail if the user doesn’t exist on Discourse yet. The best way to avoid issue with this would be to add users to groups with SSO. Setting this up is somewhat technical though: Managing Discourse group membership with WP Discourse.