Index: core/units/configuration/configuration_event_handler.php =================================================================== --- core/units/configuration/configuration_event_handler.php +++ core/units/configuration/configuration_event_handler.php @@ -304,7 +304,15 @@ // update value in cache, so other code (during this script run) would use new value $this->Application->SetConfigValue($variable_name, $object->GetDBField('VariableValue'), true); + + $sorting_prefix = $this->getSortingPrefix($variable_name); + + if ( $sorting_prefix ) { + $sql = 'DELETE FROM ' . TABLE_PREFIX . 'UserPersistentSessionData + WHERE VariableName LIKE "' . $sorting_prefix . '%Sortings.%"'; + $this->Conn->Query($sql); - } + } + } if ( $variable_name == 'Require_AdminSSL' || $variable_name == 'AdminSSL_URL' ) { // when administrative console is moved to SSL mode, then delete skin @@ -566,5 +574,30 @@ $fields = $config->getFields(); $fields['ModuleOwner']['options'] = $options; $config->setFields($fields); + } + + /** + * Returns prefix, related to given sorting system setting + * + * @param string $system_setting + * @return bool|string + * @access protected + */ + protected function getSortingPrefix($system_setting) + { + foreach ($this->Application->ModuleInfo as $module_info) { + if ( $module_info['Name'] == 'In-Portal' ) { + continue; + } + + $prefix = ( $module_info['Var'] == 'adm' ) ? 'c' : $module_info['Var']; + $config_mapping = $this->Application->getUnitConfig($prefix)->getConfigMapping(); + + if ( (isset($config_mapping['DefaultSorting1Field']) && $system_setting == $config_mapping['DefaultSorting1Field']) || (isset($config_mapping['DefaultSorting2Field']) && $system_setting == $config_mapping['DefaultSorting2Field']) ) { + return $prefix; + } + } + + return false; } } \ No newline at end of file