Feature: #108832 - Introduce UserSettings object for backend user profile settings
See forge#108832
Description
A new
User object provides structured access to backend user
profile settings defined via
$GLOBALS.
UserSettings Object
The
User object can be retrieved via the backend user:
$userSettings = $GLOBALS['BE_USER']->getUserSettings();
// Check if a setting exists
if ($userSettings->has('colorScheme')) {
$scheme = $userSettings->get('colorScheme');
}
// Get all settings as array
$allSettings = $userSettings->toArray();
// Typed access via dedicated methods
$emailOnLogin = $userSettings->isEmailMeAtLoginEnabled();
$showUploadFields = $userSettings->isUploadFieldsInTopOfEBEnabled();
The class implements
\Psr\ with
has
and
get methods. The
get method throws
User if the setting does not exist.
New JSON Storage with Backward Compatibility
Profile settings are now stored in a new
be_ JSON
field, providing a structured and queryable format. For backward compatibility,
the existing serialized
uc blob continues to be written alongside:
// Writing still uses the uc mechanism
$GLOBALS['BE_USER']->uc['colorScheme'] = 'dark';
$GLOBALS['BE_USER']->writeUC();
// Both uc (serialized) and user_settings (JSON) are updated
An upgrade wizard "Migrate user profile settings to JSON format" migrates
existing settings from the
uc blob to the new
user_ field.
Impact
Backend user profile settings can now be accessed via the
User
object, providing type safety and IDE support. The new JSON storage format
improves data accessibility while maintaining full backward compatibility
through dual-write to both storage formats.