• Модуль: blog
  • Путь к файлу: ~/bitrix/modules/blog/lib/bloguser.php
  • Класс: BitrixBlogBlogUser
  • Вызов: BlogUser::isUserGivenConsent
static function isUserGivenConsent($userId, $agreementId)
{
	if (!$userId || $userId <= 0)
		throw new ArgumentNullException('User ID');
	if (!$agreementId || $agreementId <= 0)
		throw new ArgumentNullException('Agreement ID');

//		Find root URL for current component. We will check this URL in consents table.
//		URL will be common for any constnt in this component
	$request = Application::getInstance()->getContext()->getRequest();
	$url = $request->getHttpHost() . $request->getScriptFile();
	$urlDir = pathinfo($url);
	$urlDir = $urlDir['dirname'];
	
	$filter = array(
		"=USER_ID" => $userId,
		"%=URL" => "%$urlDir%",
		"=AGREEMENT_ID" => $agreementId,
	);
	
	$isGivenAgreement = false;
	$consents = ConsentTable::getList(array('filter' => $filter));
	if ($consents->fetch())
		$isGivenAgreement = true;
	
	return $isGivenAgreement;
}