• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/Configuration/General.php
  • Класс: BitrixImConfigurationGeneral
  • Вызов: General::getUserSettings
static function getUserSettings(int $userId): array
{
	$defaultSettings = self::getDefaultSettings();
	$result =
		OptionUserTable::query()
			->addSelect('GENERAL_GROUP_ID')
			->where('USER_ID', $userId)
			->fetch()
	;

	$groupId = is_array($result) ? $result['GENERAL_GROUP_ID'] : null;
	if (!$groupId)
	{
		return $defaultSettings;
	}

	$query =
		OptionStateTable::query()
			->setSelect(['NAME', 'VALUE'])
			->where('GROUP_ID', $groupId)
			->whereLike('NAME', static::ENTITY.'%')
	;

	$settings = [];
	foreach ($query->exec() as $rowSetting)
	{
		$settings[$rowSetting['NAME']] = $rowSetting['VALUE'];
	}

	if(empty($settings))
	{
		return $defaultSettings;
	}

	$settings = static::decodeSettings($settings);

	return array_replace_recursive($defaultSettings, $settings);
}