chek user on registered in BP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
CModule::IncludeModule('nbsriter');
CModule::IncludeModule('nbs_extended_api');
CModule::IncludeModule('nbs_ad_campaing');
if(!CModule::IncludeModule("refcode"))
exit ("Ref code");
if(!CModule::IncludeModule("nbs_crm_sync"))
echo "Модуль не установлен! ";
$rsUsers = CUser::GetList(($by="id"), ($order="asc"), array()); // выбираем пользователей
while($arFields = $rsUsers->GetNext())
{
$arSelect = Array("ID", "PROPERTY_S_USER", "PROPERTY_BP_REG", "PROPERTY_BP_ANKETA");
$arFilter = Array("IBLOCK_ID" => 107, "=PROPERTY_S_USER" => $arFields['ID']);
$result = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
if($res = $result->GetNext())
{
$res = ( !empty($res['PROPERTY_BP_REG_VALUE']) )? $res['PROPERTY_BP_REG_VALUE'] : "Нет";
if($res == "Да")
{
User::userPasstAnketingBP($arFields['ID']);
User::userStartAnketingBP($arFields['ID']);
}
else
{
if(!$res['PROPERTY_BP_ANKETA_VALUE'])
User::userStartAnketingBP($arFields['ID']);
}
//1422
}
}