Sso overrides avatar

I’ve read through these:

Users who have set their avatar (via picture upload) in wordpress display a default gravatar in Discourse.

Comparing Discourse users, they have separate gravatar URLs:

http://0.gravatar.com/avatar/6d4c49710ee6a33fa4e8a674e7c10523?s=96&d=mm&r=g

http://0.gravatar.com/avatar/c2347da352720d16473af84bcacb7924?s=96&d=mm&r=g

What do I begin to look at to diagnose this?

1 Like

I believe that the avatars don’t get updated until they log in again.

I’ve tried this out in my local development environment and there seems to be a problem with the way it’s working. The avatar_url is being sent to Discourse on login, but it is only being used by Discourse when the user’s profile picture is set to use the ‘system assigned profile picture’. This change - from the system assigned image to the SSO image - only works once. After the system assigned image is overridden by the SSO image it becomes a ‘custom picture’ and is not overwritten when the SSO avatar is changed.

Also, the Discourse setting ‘sso overrides avatar’ doesn’t seem to be doing anything except making it impossible for a user to edit their profile picture on Discourse.

1 Like

What seem to be happening is that when WordPress avatar is set using Gravatar, changing the Gavatar doesn’t change the avatar URL, so the test for avatar_changed in discourse_single_sign_on.rb is failing.

I can change the wp_discourse plugin to send the parameter avatar_force_update = 'true' with the SSO parameters. That works, but it overrides the Discourse setting sso_overrides_avatar, so it will change user avatars when that setting isn’t selected.

Here is my code:

sso.avatar_url = current_user.photo.thumb.url

A user logs into the discourse for the first time, their avatar does not change.

They log out.

Now on logging back in again, the avatar is changed.

1 Like