Answer the question
In order to leave comments, you need to log in
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
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.
Comments appear only after an attempt to add a new comment.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question