- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/rest.php
- Класс: CSocNetLogRestService
- Вызов: CSocNetLogRestService::requestGroupUser
static function requestGroupUser($arFields): bool
{
$groupID = $arFields['GROUP_ID'] ?? null;
$message = $arFields['MESSAGE'] ?? null;
if ((int)$groupID <= 0)
{
throw new ArgumentException('Wrong group ID');
}
$filter = [
'ID' => $groupID,
'CHECK_PERMISSIONS' => self::getCurrentUserId(),
];
if (self::getCurrentUserType() === 'extranet')
{
$filter['SITE_ID'] = self::getExtranetSiteId();
}
$dbRes = CSocNetGroup::getList([], $filter);
$arGroup = $dbRes->Fetch();
if (is_array($arGroup))
{
$url = (CMain::IsHTTPS() ? "https://" : "http://").$_SERVER["HTTP_HOST"].CComponentEngine::MakePathFromTemplate("/workgroups/group/#group_id#/requests/", array("group_id" => $arGroup["ID"]));
if (!CSocNetUserToGroup::SendRequestToBeMember(self::getCurrentUserId(), $arGroup["ID"], $message, $url, false))
{
throw new SystemException('Cannot request to join group');
}
return true;
}
throw new ObjectNotFoundException('Socialnetwork group not found');
}