Reset Users Default Avatars?

Is there any way to “reset” all the user’s avatars who are using the default avatar so that they will be given a random avatar from the list of selectable avatars I recently added instead of having the Discourse default where it’s just initials and a color?

1 Like

Interesting question :thinking:

Run this in the rails console

uploads = Upload.where(url: SiteSetting.selectable_avatars.split("\n")).all
if uploads.present?
  User.where(uploaded_avatar_id: nil).find_each do |user|
    upload = uploads.sample

I tried that and it didn’t seem to work. I kept getting errors about a missing method?

I should note this is my first time entering the rails console, so I might not be doing that right, I followed the terminal commands from the first reply on this topic, but instead of ./launcher ssh app I did ./launcher enter app, if this is the issue can you let me know how to get into the rails console?