• Модуль: mobile
  • Путь к файлу: ~/bitrix/modules/mobile/classes/general/mobile_helper.php
  • Класс: CMobileHelper
  • Вызов: CMobileHelper::getUserInfo
static function getUserInfo($userId)
{
	if (!intval($userId))
		return;

	$dbUser = CUser::GetList("", "", array("ID_EQUAL_EXACT" => $userId), array("FIELDS" => array("NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO")));
	if ($arUser = $dbUser->Fetch())
	{
		$userPhoto = CFile::ResizeImageGet(
			$arUser["PERSONAL_PHOTO"], array('width' => 50, 'height' => 50), BX_RESIZE_IMAGE_EXACT);

		$userName = CUser::FormatName(
			CSite::GetNameFormat(false),
			array(
				'LOGIN' => isset($arUser['LOGIN']) ? $arUser['LOGIN'] : '',
				'NAME' => isset($arUser['NAME']) ? $arUser['NAME'] : '',
				'LAST_NAME' => isset($arUser['LAST_NAME']) ? $arUser['LAST_NAME'] : '',
				'SECOND_NAME' => isset($arUser['SECOND_NAME']) ? $arUser['SECOND_NAME'] : ''
			),
			true, false
		);

		return array(
			"id" => $userId,
			"name" => $userName,
			"avatar" => $userPhoto["src"]
		);
	}

	return;
}