# Reset all avatars back to default

**URL:** https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929
**Category:** Support
**Created:** [June 21, 2017, 10:22pm UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929 "2017-06-21T22:22:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Brock\_Busby](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brock_busby/32/118746_2.png) [@Brock\_Busby](https://meta.discourse.org/u/Brock_Busby)
#### Post date: [June 21, 2017, 10:22pm UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/1 "2017-06-21T22:22:02Z")

</div>

We would like to reset all users back to default avatar (the first letter of their username).  
I saw this post where @codinghorror mentions to run a query.

> [@How could I remove all avatars and reset to default?](https://meta.discourse.org/t/how-could-i-remove-all-avatars-and-reset-to-default/29721/2):
>
> Write a query that replaces the user preference for avatar to the default of “use gravatar”.

But can someone please provide the query to reset this?

Thanks in advance

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [June 21, 2017, 10:22pm UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/2 "2017-06-21T22:22:58Z")

</div>

Sure @techapj can provide this, may be useful for other sites as well.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [June 22, 2017, 1:11pm UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/3 "2017-06-22T13:11:48Z")

</div>

To reset all user avatars to system generated avatar, here is what needs to be done on server:

```bash
cd /var/discourse
./launcher enter app
rails c
User.human_users.update_all(uploaded_avatar_id: nil)

```

@Brock_Busby Since you are hosted by us, I can do this for you. Should I go ahead and reset all avatars on your Discourse instance?

---

<div class="post-metadata">

### Author: ![Brock\_Busby](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brock_busby/32/118746_2.png) [@Brock\_Busby](https://meta.discourse.org/u/Brock_Busby)
#### Post date: [June 22, 2017, 6:02pm UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/4 "2017-06-22T18:02:12Z")

</div>

This is great @techAPJ. Thank you for this. Two more questions:

1. Will this affect system and discobot avatars?
2. Do we need to run the rebake posts and refresh avatars command lines after?

And no need to reset on our hosted account. Thanks anyway.

---

<div class="post-metadata">

### Author: ![Brock\_Busby](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brock_busby/32/118746_2.png) [@Brock\_Busby](https://meta.discourse.org/u/Brock_Busby)
#### Post date: [June 23, 2017, 7:52pm UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/5 "2017-06-23T19:52:42Z")

</div>

Fyi this worked for us but we had to manually reset “system” and “discobot” avatars back to their original value.

> [@Reset all avatars back to default](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/3):
>
> To reset all user avatars to system generated avatar, here is what needs to be done on server: cd /var/discourse ./launcher enter app rails c User.human\_users.update\_all(uploaded\_avatar\_id: nil)@Brock_Busby Since you are hosted by us, I can do this for you. Should I go ahead and reset all avatars on your Discourse instance?

So BEFORE you run this command, double check the values in uploaded\_avatar\_id for “system” and “discobot” and set those back, and you should be good to go!

Thanks for the help all!

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [June 24, 2017, 1:23pm UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/6 "2017-06-24T13:23:21Z")

</div>

> [@Brock\_Busby](#):
>
> Will this affect system and discobot avatars?

Yes, good point. The original query I mentioned will, here is the updated query that will not:

```
User.human_users.update_all(uploaded_avatar_id: nil)

```

(I updated my previous answer to update the query.)

> [@Brock\_Busby](#):
>
> Do we need to run the rebake posts and refresh avatars command lines after?

No, nothing else is needed.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 11, 2023, 5:33am UTC](https://meta.discourse.org/t/reset-all-avatars-back-to-default/64929/8 "2023-05-11T05:33:29Z")

</div>


