This is a comment on Cannot switch theme, posted by WikiAdmin at 15.06.2019 10:05
View source for setting new default theme versus user theme
The Admin Panel sets the value for the default ##theme## in the secondary config, which affects of course only guests and new users. What you are looking for is a function which sets a selected theme for all users. %%(sql)UPDATE wacko_user_setting SET theme = 'default'%% This option would then overwrite all set themes in the user_setting table. %%(hl diff) diff --git a/wacko/admin/lang/ap.en.php b/wacko/admin/lang/ap.en.php --- a/wacko/admin/lang/ap.en.php +++ b/wacko/admin/lang/ap.en.php @@ -405,6 +405,9 @@ 'LayoutSection' => 'Layout', 'Theme' => 'Theme', 'ThemeInfo' => 'Template design the site uses by default.', + 'ResetUserTheme' => 'Reset all user themes', + 'ResetUserThemeInfo' => 'Resets all user themes. Warning: This action will set back all user selected themes to the global default theme.', + 'SetBackUserTheme' => 'Set back all user themes to %1 theme.', 'ThemesAllowed' => 'Allowed Themes', 'ThemesAllowedInfo' => 'Select the allowed themes, which the user can choose, otherwise all available themes are allowed.', 'ThemesPerPage' => 'Themes per page', diff --git a/wacko/admin/module/config_appearance.php b/wacko/admin/module/config_appearance.php --- a/wacko/admin/module/config_appearance.php +++ b/wacko/admin/module/config_appearance.php @@ -184,6 +184,19 @@ $engine->http->redirect(rawurldecode($engine->href())); } + // set back all user themes to curent default theme + if (isset($_POST['reset_user_theme'])) + { + $engine->db->sql_query( + "UPDATE " . $engine->db->table_prefix . "user_setting SET + theme = " . $engine->db->q($engine->db->theme) . ""); + + $engine->set_message(Ut::perc_replace($engine->_t('SetBackUserTheme'), '<code>' . $engine->db->theme . '</code>' ), 'success'); + $engine->log(4, Ut::perc_replace($engine->_t('SetBackUserTheme', SYSTEM_LANG), '##' . $engine->db->theme . '##' )); + + $engine->http->redirect(rawurldecode($engine->href())); + } + // update settings if (isset($_POST['action']) && $_POST['action'] == 'update') { @@ -335,6 +348,18 @@ </td> </tr> <tr class="lined"> + <td colspan="2"></td> + </tr> + <tr class="hl-setting"> + <td class="label"> + <label for="reset_user_theme"><strong><?php echo $engine->_t('ResetUserTheme'); ?>:</strong><br> + <small><?php echo $engine->_t('ResetUserThemeInfo'); ?></small></label> + </td> + <td> + <input type="submit" id="reset_user_theme" name="reset_user_theme" value="<?php echo $engine->_t('ResetUserTheme'); ?>"> + </td> + </tr> + <tr class="lined"> <td colspan="2"></td> </tr> <tr class="hl-setting"> %% Maybe this should be placed in an extra module dedicated to resetting user settings (default -> user setting)