Use displayname from wp as username in discourse

Hey everyone!

Our forum has a unique need that we must not be able to see the user’s real name, for legal reasons.

We’re using this plugin - SX User Name Security – WordPress plugin | - to generate a random displayname in wordpress. Is it possible to override discourse’s use of the username, and use the displayname instead?

(If not, does anyone know of a way to generate random username in wp instead?)

Thanks all!

1 Like

Have you considered using SSO with Wordpress as the master?


Hey! Thanks for replying :slight_smile:

We are using wp as the sso provider. Its default is to use the real name if present, so it’s ignoring the displayname when there’s a real name (which there always will be).

1 Like

I see. I didn’t quite understand the way the WP plug-in works. I was assuming the usernames were replaced so that the real names were gone.

I’m afraid this question is beyond my skill.

Perhaps @simon can help.

1 Like

The WordPress rules for display names do not match the Discourse rules for usernames, for example, spaces are allowed in WordPress display names. Passing the display name as the Discourse username for SSO login isn’t a feature that will be added to the plugin, but it is possible that it makes sense for your case.

The WP Discourse plugin has a wpdc_sso_params filter that can be used to adjust the SSO parameters that are passed to Discourse. This search will get you to a few examples of how that filter can be used: Search results for 'wpdc_sso_params' - Discourse Meta. The changes needed for this could be added to your site’s theme or to a plugin that extends the WP Discourse plugin. You could try posting in our #marketplace category to find someone to do the work for you.

1 Like