# Previously selected user themes can override allowed themes

**URL:** https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053
**Category:** Support
**Created:** [February 7, 2018, 9:43pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053 "2018-02-07T21:43:17Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2018, 9:43pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/1 "2018-02-07T21:43:17Z")

</div>

On Discourse 1.9.2 (stable) if there exists a theme “A” that gets saved as a user’s default theme and then you create a theme “B” and make theme “A” not selectable by users, people who have selected theme A still get theme A.

And if theme B is the only available theme, then there is no selector on /my/preferences/interface to be able to select theme B.

---

<div class="post-metadata">

### Author: ![Vaping\_Community](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vaping_community/32/89248_2.png) [@Vaping\_Community](https://meta.discourse.org/u/Vaping_Community)
#### Post date: [February 7, 2018, 10:13pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/2 "2018-02-07T22:13:34Z")

</div>

Even if you make theme B the default?

Can I assume that the theme choice is saved inside the session?  
I’ve been messing with my themes all day and have noticed that sometimes if I disable a theme I still have it until I clear the browser cache.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2018, 10:15pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/3 "2018-02-07T22:15:21Z")

</div>

> [@Vaping\_Community](#):
>
> Even if you make theme B the default?

Yes. Theme B is the default and no other themes are user-selectable. You have to change the theme in the user profile to get to it (or perhaps clear the browser cache?).

---

<div class="post-metadata">

### Author: ![Vaping\_Community](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vaping_community/32/89248_2.png) [@Vaping\_Community](https://meta.discourse.org/u/Vaping_Community)
#### Post date: [February 7, 2018, 10:16pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/4 "2018-02-07T22:16:25Z")

</div>

I cleared the browser cache and it reset to the default for me, I’m running v2 though..

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2018, 10:18pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/5 "2018-02-07T22:18:13Z")

</div>

Thanks. I suggested that to my not-so-technically-adept client who is more adept than most of their community.

---

<div class="post-metadata">

### Author: ![Vaping\_Community](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vaping_community/32/89248_2.png) [@Vaping\_Community](https://meta.discourse.org/u/Vaping_Community)
#### Post date: [February 7, 2018, 10:18pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/6 "2018-02-07T22:18:59Z")

</div>

Hopefully that fixes the problem, I guess the other way is to go through admin and change it manually for them (headache)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2018, 10:23pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/7 "2018-02-07T22:23:17Z")

</div>

It’s possible to update them all from the Rails console.

---

<div class="post-metadata">

### Author: ![Vaping\_Community](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vaping_community/32/89248_2.png) [@Vaping\_Community](https://meta.discourse.org/u/Vaping_Community)
#### Post date: [February 7, 2018, 10:24pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/8 "2018-02-07T22:24:01Z")

</div>

Oh, nice, I’m still learning the basic commands, is there a cheat sheet for discourse commands?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2018, 10:27pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/9 "2018-02-07T22:27:39Z")

</div>

Not quite what you’re looking for. In [Completely disable mailing list mode? - #10 by techAPJ](https://meta.discourse.org/t/completely-disable-mailing-list-mode/37334/10) I found this

```plaintext
./launcher enter app
rails c
UserOption.update_all(mailing_list_mode: false)

```

You’d do something similar, like

```
UserOption.update_all(theme_key: 666)

```

Which I found by looking in discourse/app/models/user\_option.rb.

---

<div class="post-metadata">

### Author: ![Vaping\_Community](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vaping_community/32/89248_2.png) [@Vaping\_Community](https://meta.discourse.org/u/Vaping_Community)
#### Post date: [February 7, 2018, 10:29pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/10 "2018-02-07T22:29:22Z")

</div>

So you force the same `theme_key` on every user, I assume that is the theme ID?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2018, 10:41pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/11 "2018-02-07T22:41:51Z")

</div>

That’s what it looks like. That’s not tested. It might kill your dog or something.

---

<div class="post-metadata">

### Author: ![Vaping\_Community](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vaping_community/32/89248_2.png) [@Vaping\_Community](https://meta.discourse.org/u/Vaping_Community)
#### Post date: [February 7, 2018, 10:46pm UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/12 "2018-02-07T22:46:00Z")

</div>

Ok, I just ran a test and clearing the browser cache DOES change the theme to the default one in v2 if the one the user was previously using has been removed and a new one has been set as default.

If `Make this my default theme on all devices` is checked it should revert on the next refresh.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 26, 2018, 4:29am UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/14 "2018-04-26T04:29:35Z")

</div>

This is only the case if you are an administrator, as an end user this can not happen. I just confirmed cause we do a security check and only allow end users to see themes that are user selectable.

I am recategorizing this as support for now cause I feel it is too minor to need fixing.

---

<div class="post-metadata">

### Author: ![WaitroseCarpark](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waitrosecarpark/32/198599_2.png) [@WaitroseCarpark](https://meta.discourse.org/u/WaitroseCarpark)
#### Post date: [May 14, 2019, 8:58am UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/15 "2019-05-14T08:58:49Z")

</div>

Sorry to drag this one up. How can I find out what a ‘theme\_key’ is per theme?

\*\*Edit: Is it the number at end of URL if you go to settings/customise/themes and select the one you want?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 14, 2019, 10:05am UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/16 "2019-05-14T10:05:07Z")

</div>

Theme\_key is no longer used. Instead, you would do

```plaintext
UserOption.update_all(theme_ids: [666])

```

Where 666 is the **id** of the theme (the number in the URL when you go to edit it in the admin panel)

---

<div class="post-metadata">

### Author: ![WaitroseCarpark](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waitrosecarpark/32/198599_2.png) [@WaitroseCarpark](https://meta.discourse.org/u/WaitroseCarpark)
#### Post date: [May 19, 2019, 2:51am UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/17 "2019-05-19T02:51:28Z")

</div>

> [@pfaffman](#):
>
> iscourse/app/models/user\_option.rb.

So for my instance I typed this:

```
./launcher enter app
rails c
UserOption.update_all(theme_ids: [3])

```

Worked super fast (\<1 sec) and changed all my user themes to my predetermined default. Perfect, thank you @pfaffman

---

<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: [October 2, 2022, 8:15am UTC](https://meta.discourse.org/t/previously-selected-user-themes-can-override-allowed-themes/80053/19 "2022-10-02T08:15:17Z")

</div>


