Automatically transferring themes

Hi,

Is there any mechanism (or query) that could easily take everyone who currently has enabled Theme ID X and swap them to Theme ID Y.

I currently have Theme X which is a bunch of messy components and want to replace it with an identical Theme Y which will be linked to GitHub. But I don’t want everyone who has chosen Theme X to notice any difference (i.e. I can’t just delete it and tell them all to pick Y).

Any help would be appreciated :grin:

I guess I could import the GitHub theme as a new component and make it the only component of Theme X. (at least I think that would work?) But that doesn’t seem the most elegant solution.

This should do it, but you should make a backup first.

get into rails

cd /var/discourse
./launcher enter app

do these commands

old_id=2
new_id=21
UserOption.where(theme_ids: [old_id]).update_all(theme_ids: [new_id])
4 Likes

Great, cheers!

1 Like