Code reset and solved other issues with comments

This commit is contained in:
Jose Gonzalez 2019-12-05 17:06:58 +01:00
parent 0ba2d86971
commit 3652f31a18
2 changed files with 8 additions and 3 deletions

View File

@ -128,7 +128,7 @@ if ($get_comments) {
); );
if ($events !== false) { if ($events !== false) {
$event = $events[0]; $event = $events;
} }
} }

View File

@ -1262,6 +1262,11 @@ function events_get_all(
unset($fields[$idx]); unset($fields[$idx]);
} }
} }
} else {
$idx = array_search('te.user_comment', $fields);
if ($idx !== false) {
$fields[$idx] = 'te.user_comment AS comments';
}
} }
$sql = sprintf( $sql = sprintf(
@ -4604,12 +4609,12 @@ function events_page_comments($event, $ajax=false)
continue; continue;
} }
$comments_array[] = json_decode(io_safe_output($comm), true); $comments_array[] = io_safe_output(json_decode($comm, true));
} }
} else { } else {
$comments = str_replace(["\n", '&#x0a;'], '<br>', $comments); $comments = str_replace(["\n", '&#x0a;'], '<br>', $comments);
// If comments are not stored in json, the format is old. // If comments are not stored in json, the format is old.
$comments_array[] = json_decode(io_safe_output($comments), true); $comments_array[] = io_safe_output(json_decode($comments, true));
} }
foreach ($comments_array as $comm) { foreach ($comments_array as $comm) {