# User avatar preference spontaneously changing to "Custom picture"

**URL:** <https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977>\
**Category:** WordPress\
**Created:** [February 6, 2017, 2:34pm UTC](https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977 "2017-02-06T14:34:09Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [February 8, 2017, 12:20am UTC](https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977/5 "2017-02-08T00:20:46Z")

</div>

> [@pjv](#):
>
> So are you saying you think that this behavior is because of the WP SSO even though I have the setting for overriding the avatar turned off in Discourse?

Yes, the problem I’m seeing is when a user has an existing account on both Discourse and WordPress, but the accounts have not yet been synced. In that case, when the user first logs in with SSO, if the `avatar_url` is present in the SSO parameters, the job `download_avatar_from_url` is enqueued. This checks for the user’s `uploaded_avatar_id`. If that isn’t present, then the `avatar_url` from the SSO parameters is used. This happens whether or not the SiteSetting `sso_overrides_avatar` has been set.

We can get around this in the wp-discourse plugin by adding a ‘SSO overrides avatar’ setting. If it is not set, then the WordPress `avatar_url` won’t be sent with the SSO parameters. If it is set, the `avatar_url` will be sent with the SSO parameters, and also `force_avatar_update` can be added to the parameters and set to true. Doing that will make it possible for avatars to be updated on Discourse when the Gravatar image is changed through WordPress.

What I can’t figure out is a good way to check on WordPress if the default avatar (usually the mystery person) is being used. I think in most cases, people would rather keep the default Discourse avatar instead of having it overridden with this:  
 ![](https://global.discourse-cdn.com/meta/original/3X/f/6/f6c5f1b0572e0a142ce4fd78979ef592611bf88b.png)

---

_[View the full topic](https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977)._
