• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/componenthelper.php
  • Класс: BitrixSocialnetworkComponentHelper
  • Вызов: ComponentHelper::getBlogAuthorData
static function getBlogAuthorData($authorId, $params): array
{
	if (isset(self::$authorsCache[$authorId]))
	{
		$result = self::$authorsCache[$authorId];
	}
	else
	{
		if (!Loader::includeModule('blog'))
		{
			throw new MainSystemException("Could not load 'blog' module.");
		}

		$result = CBlogUser::getUserInfo(
			(int)$authorId,
			'',
			[
				"AVATAR_SIZE" => (
					isset($params["AVATAR_SIZE"])
					&& (int)$params["AVATAR_SIZE"] > 0
						? (int)$params["AVATAR_SIZE"]
						: false
				),
				"AVATAR_SIZE_COMMENT" => (
					isset($params["AVATAR_SIZE_COMMENT"])
					&& (int)$params["AVATAR_SIZE_COMMENT"] > 0
						? (int)$params["AVATAR_SIZE_COMMENT"]
						: false
				),
				"RESIZE_IMMEDIATE" => "Y"
			]
		);

		$result["NAME_FORMATTED"] = CUser::formatName(
			CSite::getNameFormat(false),
			[
				"NAME" => $result["~NAME"],
				"LAST_NAME" => $result["~LAST_NAME"],
				"SECOND_NAME" => $result["~SECOND_NAME"],
				"LOGIN" => $result["~LOGIN"]
			],
			true
		);

		self::$authorsCache[$authorId] = $result;
	}

	return $result;
}