30 $logId = (isset($params[
'logId']) ? (int)$params[
'logId'] : 0);
39 $res = LogRightTable::getList([
43 'select' => [
'GROUP_CODE' ]
45 while ($logRight = $res->fetch())
47 if (preg_match(
'/^U(\d+)$/', $logRight[
'GROUP_CODE'], $matches))
49 $destUserIdList[] = $matches[1];
53 $defaultFollowValue =
false;
54 $userFollowValue = [];
56 if (!empty($destUserIdList))
62 $res = LogFollowTable::getList([
64 '=CODE' => [
'**', $key ],
65 '@USER_ID' => $destUserIdList
67 'select' => [
'CODE',
'TYPE',
'USER_ID' ]
69 while($logFollow = $res->fetch())
71 if (!isset($userFollowValue[$logFollow[
'USER_ID']]))
73 $userFollowValue[$logFollow[
'USER_ID']] = [];
75 $userFollowValue[$logFollow[
'USER_ID']][$logFollow[
'CODE']] = $logFollow[
'TYPE'];
79 foreach($destUserIdList as $destUserId)
81 $subscribeTypeList = [];
85 !isset($userFollowValue[$destUserId])
86 && $defaultFollowValue ===
'N'
89 isset($userFollowValue[$destUserId])
90 && !isset($userFollowValue[$destUserId][$key])
91 && $userFollowValue[$destUserId][
'**'] ===
'N'
95 $subscribeTypeList[] =
'FOLLOW';
98 \Bitrix\Socialnetwork\ComponentHelper::userLogSubscribe([
100 'userId' => $destUserId,
101 'typeList' => $subscribeTypeList,
102 'followDate' =>
'CURRENT'