- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/log_follow.php
- Класс: CSocNetLogFollow
- Вызов: CSocNetLogFollow::checkAutoUnfollow
static function checkAutoUnfollow($traffic_cnt, $traffic_avg, $userId = false)
{
global $USER;
if (
intval($traffic_cnt) > 10
&& intval($traffic_avg) < 60*60*4 // 4 hours
)
{
$userId = (
!$userId
|| intval($userId) <= 0
? $USER->GetID()
: intval($userId)
);
$default_follow = CSocNetLogFollow::GetDefaultValue($userId);
if ($default_follow == 'Y')
{
$isAlreadyChecked = CUserOptions::GetOption("socialnetwork", "~log_autofollow_checked", "N", $userId);
if ($isAlreadyChecked != 'Y')
{
if (CModule::IncludeModule('im'))
{
$arMessageFields2Send = array(
"MESSAGE_TYPE" => IM_MESSAGE_SYSTEM,
"NOTIFY_TYPE" => IM_NOTIFY_CONFIRM,
"NOTIFY_MODULE" => "socialnetwork",
"NOTIFY_EVENT" => "sonet_auto_unfollow_btn",
"NOTIFY_TAG" => "SONET|UNFOLLOW|".$userId,
"TO_USER_ID" => $userId,
"NOTIFY_MESSAGE" => GetMessage(BitrixMainModuleManager::isModuleInstalled('intranet' ? "SONET_LF_UNFOLLOW_IM_MESSAGE2" : "SONET_LF_UNFOLLOW_IM_MESSAGE")),
"NOTIFY_MESSAGE_OUT" => IM_MAIL_SKIP,
"NOTIFY_BUTTONS" => Array(
Array("TITLE" => GetMessage("SONET_LF_UNFOLLOW_IM_BUTTON_Y"), "VALUE" => "Y", "TYPE" => "accept"),
Array("TITLE" => GetMessage("SONET_LF_UNFOLLOW_IM_BUTTON_N"), "VALUE" => "N", "TYPE" => "cancel"),
)
);
CIMNotify::Add($arMessageFields2Send);
}
CUserOptions::SetOption("socialnetwork", "~log_autofollow_checked", "Y", false, $userId);
}
}
}
}