Upgraded comment creation

This commit is contained in:
Pierre
2018-04-22 13:51:22 +02:00
parent c3af9124b6
commit ddfe2f4e8e
2 changed files with 14 additions and 15 deletions

View File

@ -33,13 +33,15 @@ class CommentsController {
else
$content = $this->get_comment_content("content", true);
//Create comment object with new information
$comment = new Comment();
$comment->set_postID($postID);
$comment->set_userID(userID);
$comment->set_content($content);
$comment->set_img_path(isset($image_path) ? $image_path : "");
//Try to create the comment
$commentID = components()->comments->create(
$postID,
userID,
$content,
isset($image_path) ? $image_path : ""
);
$commentID = components()->comments->create($comment);
//Check for errors
if($commentID < 1)