WP Discourse + missing SSO records

Yes, it will have to do with having created the users through the add_user_to_discourse_group function. Assuming that everything is working correctly, the users who were created in that way who have not yet logged into Discourse will not yet have SSO records. When they login to Discourse, SSO records will be created for them.

The ‘2’ being appended to the username should only happen if Discourse returns an error saying that the username is already taken when an attempt is made to add a user to Discourse.

The active status should be applied to users who have validated their email addresses on WordPress. It would also be applied to any users who were created before you first installed the WP Discourse plugin.

There are issues with the way this function is working when it’s applied to a lot of users at the same time. I’m going to change all of the functions in the WP Discourse plugin that are creating users through the API so that they use the Discourse sync_sso route instead of making API calls. This will be in the next update to the plugin.