From 2e8c5340775d35c6ad30a3a4823c3745c022a178 Mon Sep 17 00:00:00 2001 From: Jack Anderson Date: Thu, 18 Jul 2024 15:39:13 +0100 Subject: [PATCH] Add check for current user on preferences --- modules/UserPreferences/UserPreference.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/UserPreferences/UserPreference.php b/modules/UserPreferences/UserPreference.php index dd648bee9dc..3977dd62d24 100755 --- a/modules/UserPreferences/UserPreference.php +++ b/modules/UserPreferences/UserPreference.php @@ -98,10 +98,15 @@ public function getPreference( $name, $category = 'global' ) { - global $sugar_config; + global $sugar_config, $current_user; $user = $this->_userFocus; + if ($user->user_name !== $current_user->user_name){ + $this->loadPreferences($category); + return $_SESSION[$user->user_name.'_PREFERENCES'][$category][$name]; + } + // if the unique key in session doesn't match the app or prefereces are empty if (!isset($_SESSION[$user->user_name.'_PREFERENCES'][$category]) || (!empty($_SESSION['unique_key']) && $_SESSION['unique_key'] != $sugar_config['unique_key'])) { $this->loadPreferences($category);