Time Zone resets itself to UTC in Version 8.7.1

The time zone resets itself to UTC, after saving the preferences as UTC-6 checking the settings again it resets to UTC.

We already did what is mentioned here:

no results.

Can anyone help?

Welcome!

After setting in php.ini file, you need to restart your apache2/nginx web server.

SuiteCRM 8.7.0 and 8.7.1 contains a bug that resets timezone to UTC on user login.

If all your users can have the same timezone you can create a hook to fix this issue:

// FILE: // /var/www/public/legacy/custom/Extension/modules/Users/TimezoneQuickFix.php
class TimezoneQuickFix
{
    const FORCED_TIMEZONE = 'Europe/Vatican';
    
    function fix($bean, $event, $arguments)
    {
        global $current_user;

        if ('UserPreference' != $bean->object_name ?? ''){
            return;
        }
        if (self::FORCED_TIMEZONE == $current_user->getPreference('timezone')){
            return;
        }
        $current_user->setPreference('timezone', self::FORCED_TIMEZONE, 0, 'global');
    }
}

AND

// FILE: /var/www/public/legacy/custom/Extension/application/Ext/LogicHooks/TimezoneQuickFix_Hook.php
$hook_array['after_save'][] = Array(1, 'Fix timezone returning to UTC', 'custom/Extension/modules/Users/TimezoneQuickFix.php','TimezoneQuickFix', 'fix'); 

Quick Repair and Rebuild

2 Likes

Thank you. It really works. But in Version 8.7.1 there is also a problem with saving other settings. Can you help with writing a similar hook to enable these options by default for all users: 1. Show Full Names, 2. Module Menu Filters, 3. Show collapsed subpanel hint, 4. Subpanel Tabs . It is very important for me that these settings are also enabled. Thank you for your help. I’m not the only one who has encountered this problem. 8.7 - User preferences not saving between sessions

1 Like