From bb0dc94d96267228462e4adbffc3ed2d648b95da Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 27 Jan 2018 18:39:08 +0100 Subject: [PATCH] Can get informations about a single comment. --- RestControllers/commentsController.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/RestControllers/commentsController.php b/RestControllers/commentsController.php index 9654046..42ea0eb 100644 --- a/RestControllers/commentsController.php +++ b/RestControllers/commentsController.php @@ -7,6 +7,27 @@ class commentsController { + /** + * Get informations about a single comment + * + * @url POST /comments/get_single + */ + public function get_single_infos(){ + + //Get the comment ID + $commentID = getPostCommentIDWithAccess("commentID"); + + //Get informations about the comment + $infos = components()->comments->get_single($commentID, TRUE); + + //Check for errors + if(count($infos) == 0) + Rest_fatal_error(500, "Couldn't fetch informations about the comment !"); + + //Return informations about the comment + return $infos; + } + /** * Edit a comment content *