The selected theme is not displayed in the Settings->Display->Display Theme Select
Created by: subrealist
The selected theme is not displayed in the Settings->Display->Display Theme Select
If several themes are available and selected theme isn't in top select option and selected scheme isn't scheme by default then selected theme isn't displayed in the Settings->Display->Display Theme Select after Settings->Display loading.
Steps to reproduce
- Open Settings->Display from Profile menu
- Make sure that several themes are available in Display Theme select options (eg 'bookish', 'mytheme','redbasic' in this order from top to bottom)
- Select the theme which isn't in the top option list and has several Select scheme options (eg 'mytheme')
- Select scheme in the Select scheme select which isn't default scheme (eg 'BS-Default')
- Click 'Submit' button
Expected result
The theme 'mytheme' is selected in Display Theme Select after page reload
Actual result
The theme 'bookish' is selected in Display Theme Select after page reload
My invistigation
I found that when you select a different scheme from the default scheme then in the file 'Zotlabs/Module/Display.php' Line 161 (master and dev) the $theme_selected variable gets the value 'mytheme:BS-Default' which can't be the same as any option values in the file ' hubzilla/view/tpl/field_themeselect.tpl' Line 7 and selected theme can't be displayed as selected.
My workaround
'Zotlabs/Module/Display.php'
161 $theme_selected = ((array_key_exists('theme',$_SESSION) && $_SESSION['theme']) ? $_SESSION['theme'] : $theme);
162
163+ if (strpos($theme_selected, ':')) {
164+ $theme_selected = explode(':', $theme_selected)[0];
165+ }
166+
167 $mobile_theme_selected = (!x($_SESSION,'mobile_theme')? $default_mobile_theme : $_SESSION['mobile_theme']);