SSO plugin is very good.
But it can not sync user avatar from discourse for wordpress.
Could you update for this?
AI-generated summary
The discussion revolves around updating user avatars for a WordPress plugin using Single Sign-On (SSO). cmdntd requests an update to sync user avatars from Discourse to WordPress. angus explains that WordPress doesn’t support custom avatars out of the box and suggests using a filter (wpdc_sso_client_updated_user) to access the Discourse avatar URL.
cmdntd finds a suitable plugin, Simple Local Avatars, but wants to restrict users from changing their avatars. angus confirms that it’s possible to force users to use their Discourse avatar without giving them permission to change it, but recommends seeking help from the plugin developers or hiring someone from the Marketplace for the integration.
Hey @cmdntd ![]()
It sounds like you have Discourse setup as the DiscourseConnect provider for Wordpress via the WP Discourse plugin? Is that right?
Wordpress doesn’t actually have custom user avatars out of the box. You need to use a Wordpress avatar plugin. This is partly why the WP Discourse plugin doesn’t just have a setting to sync Discourse avatars when Discourse is the DiscourseConnect provider, as the way custom avatars are handled will depend on the way a Wordpress implements that kind of custom feature.
However, the WP Discourse plugin gives you a filter you can use to access the Discourse avatar url: wpdc_sso_client_updated_user. This filter will be applied every time the user logs in to Wordpress using DiscourseConnect.
add_filter( 'wpdc_sso_client_updated_user', 'my_wpdc_sso_client_updated_user', 10, 2 );
function my_wpdc_sso_client_updated_user( $updated_user, $query ) {
## use $query['avatar_url']
}
So, if you use a Wordpress avatar plugin to allow users to set custom avatars in Worpress and this filter you can set Wordpress user’s avatars as their Discourse avatar when Discourse is the DiscourseConnect Provider.
Thanks, that’s exactly Discourse Connect provider for Wordpress. I’ve seen this plugin:
But this plugin also give permission to change avatar for users
In fact, I do not want users to change their avatar. Could I force users use discourse avatar without change avatar permission?
Yes, you could use that plugin. You’ll need to use the the filter I mentioned to set the avatar image using the discourse image_url. That will be specific to the Simple Local Avatars plugin and is not something that will be included directly in the WP Discourse plugin.
If you’re unsure about how to handle that integration, you could either reach out to the developers of the plugin, or hire someone in the Marketplace.