Do username/email changes in wordpress get sent over to discourse?

Hello all. I asked a similar question recently but this is a bit different.

Let’s say someone is logged into wordpress and changes their username or email address, does a command get sent over to the discourse database changing the username or email address over there too?

I know you’re not supposed to change your username in wordpress but bear with me on this question. :slight_smile:

Thanks!

Just to add… I did a small test like so:

  • created a wordpress user: testuser / testuser@somedomain.com
  • started some discourse threads under the testuser account
  • in wordpress changed that same user to: testuser2 / testuser2@somedomain.com
  • upon logging back in to discourse, discourse correctly had changed testuser to testuser2 and knew that all of testuser’s threads now belonged to testuser2

So I just want to verify what’s going on for certain. I thought I’d read somewhere what the plugin doesn’t go so far to update the discourse user database when a change like this happens in wordpress. But it appears that’s what going on.

Yes, once a user is created on Discourse through SSO, that user is mapped to Discourse by their SingleSignOn external_id. For the wp-discourse plugin, the external_id is the WordPress user ID. That isn’t affected by changing the email address or username.

If on the Discourse forum you have enabled the settings ‘sso overrides email’, and ‘sso overrides username’, then changes to the username and email address on the WordPress site will also change them on the Discourse site.

3 Likes

Ah, that makes total sense. The wordpress user id is stored in discourse along with that user so they can change their username and/or email and it’ll rely on the user id to match up. Thanks!!