SSO settings - integration between Wordpress and Discourse using WP plugin

I am using the Wordpress Discourse Plugin and have SSO enabled. There are a few aspects to this integration that I am unsure about.

  • I have all of the settings for SSO overriding local settings, except for avatar, as I like the default avatars in discourse. I would however like users to be able to set their own avatar, and I am imagining that the only way to do this now would be via discourse. If so, is there a way of any changes to the avatar in discourse being synched back to Wordpress?

  • Can user account deletions be synchronised between discourse and Wordpress?

  • Is there any way of including a link on the discourse profile preferences page to the user’s profile settings page in Wordpress?

There may be other questions relating to integration, but this is what strikes me for now.

Yes, this can be done very easily with a plugin. All that’s needed is a link to I wonder if this could be added as a setting to Discourse?

Edit: the setting could be something like sso provider user profile url.

1 Like

I did this by creating a custom field and editing the params array on the wp-discourse plugin to include the custom field. I just have to re-paste everytime the plugin is updated.

Not to de-rail the convo but maybe a possible feature request. :wink:


Send a pull request, or message me the code.

Sorry for the delayed response but i simply alter the params array to include my custom fields like so. I also force the avatar update as my users like to change their often and I also always suggest they use Gravatar. the last 4 lines is what I add.

	$params = array(
		'nonce'       => $nonce,
		'name'        => $current_user->display_name,
		'username'    => $current_user->user_login,
		'email'       => $current_user->user_email,
		// 'true' and 'false' are strings so that they are not converted to 1 and 0 by `http_build_query`.
		'require_activation' => $require_activation ? 'true' : 'false',
		'about_me'    => $current_user->description,
		'external_id' => $current_user->ID,
		'avatar_url'  => get_avatar_url( get_current_user_id() ),
		'avatar_force_update' => 'true',
		'custom.user_field_1' => get_user_meta(get_current_user_id(), 'pie_text_7', true),
		'custom.user_field_2' => get_user_meta(get_current_user_id(), 'pie_text_8', true),
		'custom.user_field_3' => get_user_meta(get_current_user_id(), 'pie_text_9', true), 

Another approach to this would be to find a WordPress plugin for creating avatars that has a similar functionality to the way Discourse deals with them. Here is one that might work (it can’t be fully tested on a local development setup because it works by setting a custom default image for Gravatar.)

Having this as an option seems like a good idea to me.

1 Like