Override sc_set_theme macro

I have implemented a form which uses sc_set_theme to allow the user to set their theme. it works great, but when they logout, it applies the theme to the login form too, which I do not want. The login form has a background image etc and needs to look the same for all users. The other themes mess up the login screen.

I put an sc_set_theme in the sec_Login app (tried OnApplicationInit and OnScriptInit, both of which are meant to be in scope for a Control app) but SC completely ignores this macro when loading the login screen from the logout button.

How can I get the user’s theme to work everywhere except the login screen?

In case it helps someone else who stumbles across this…

The solution is to turn off the setting Application > Settings > Share Theme Variable. It then forces that app to use the specific theme set on the app, instead of the one specified by sc_set_theme().

Good to know!!

After loggin in again which theme is used? the one from the login or the one selected before loggin out?

#nonkelmike - well I am storing the selected theme on the user record (eg sec_users) as a new field. Then, on successful login, I lookup the user’s theme and use sc_set_theme again to set it as required. So each user has their own theme for the system, which they can change whenever they like. And the login screen is not affected, so it can have my snazzy background image etc. It’s working just fine now. I am using a standard Select dropdown field for selecting the theme, as the “Theme” datatype was not allowing me enough control.

nice!!! I will implement this too!

Having trouble with this. I have created a field to store the user’s choice. Using script on login to get that value (and echo indicates that it does). Using sc_set_theme(’[glo_theme]’) to set the variable. I have tried double quotes sc_set_theme("[glo_theme]") and no quotes sc_set_theme([glo_theme]). It works if I use plain text - sc_set_theme(“sc9_Rhino”). How do I make it work with a global variable?

I can not get it to work at all.

This is my statement

sc_set_theme (‘Sc9_SweetCoral’);

Can you see any problem?

May I see lines of code you used?

TY

Hi Lewis200. What type of app are you using it in? And which event? Also what is your setting for Application > Settings > Share Theme Variable?