Bitrix24 (PHP): Получение аватара пользователя (по его ID)
Данная функция позволяет получить ссылку (относительный путь) на аватар пользователя по ID пользователя.
function getUserAvatarUrl($userId) {
$userId = intval($userId);
if ($userId <= 0) return null;
$rsUser = CUser::GetByID($userId);
$arUser = $rsUser->Fetch();
if (!$arUser || empty($arUser['PERSONAL_PHOTO'])) return null;
$imgId = intval($arUser['PERSONAL_PHOTO']);
if ($imgId <= 0) return null;
return CFile::GetPath($imgId) ?: null;
}