I
I
Irek Sitdikov2016-07-20 16:50:27
1C-Bitrix
Irek Sitdikov, 2016-07-20 16:50:27

Why do comments disappear in Bitrix?

Faced the following anomaly: after executing the Update method on an element, all comments from the bitrix:forum.topic.reviews
component disappear on its page. Comments appear only after an attempt to add a new comment.
The problem is not in the cache, it is possible that an important attribute is overwritten during update.
Update code:

/*** GET Params ***/
$_name   = trim(htmlspecialchars($_POST['NAME']));
$_text   = trim(htmlspecialchars($_POST['TEXT']));

$PROPS = Array(
  'AUTHOR'            => $arItem['PROPERTIES']['AUTHOR']['VALUE'],
  'FILE'              => $arItem['PROPERTIES']['FILE']['VALUE'],
);
$arFields = Array(
  'MODIFIED_BY'     => $USER->GetID(),
  'NAME'            => $_name,
  'DETAIL_TEXT'     => $_text,
  'PROPERTY_VALUES' => $PROPS
);

$el = new CIBlockElement;
$res = $el->Update($arItem['ID'], $arFields);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-07-20
@sitdirek

If there are comments on the forum, then the Forum topic for comments FORUM_TOPIC_ID
property is overwritten. When a new comment is added, this property again gets the ID of the thread with comments, which leads to the appearance of old comments.

A
Alexey Emelyanov, 2016-07-20
@babarun

Comments appear only after an attempt to add a new comment.

Old comments showing up? Or the old ones disappear forever and only new ones start to be added?
When updating, you can remove properties if they are not explicitly specified (depends on api).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question