This is a simple comments module for Core Boxx – Add comments to a post, video, image, product, or whatever you want.
LICENSE & DOWNLOAD
Core Boxx is released under the MIT License. You are free to use it for personal and commercial projects, and modify it as you see fit. On the condition that the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.
INSTALLATION & REQUIREMENTS
- The user module must be installed.
- Unzip this module into your existing Core Boxx project folder.
lib/SQL-Comments.sqlinto your database.
lib/LIB-Comments.phpThe comments library.
lib/API-comments.phpComments API endpoint.
pages/PAGE-comment.phpComments demo page.
- This module assumes that comments are only open for registered users.
- If you want to open up for the public, some form of identification needs still need to be in place – Use a random cookie session ID as the “user ID”.
- Also, you decide if users can update and delete their own comments.
||Primary key, auto-increment.|
||The user that made the comment.|
||The ID of whatever you want to attach comments to – Post, product, image, video, etc…|
||The time when the comment is posted.|
||The comment itself.|
COMMENTS LIBRARY FUNCTIONS
Save a comment.
$idThe post/product/video/image ID.
$messageComment message itself.
$cidComment ID – If left blank, will add a new entry, if not, update this entry.
echo $_CORE->Comments->save(999, "Testing") ? "OK" : $_CORE->error;
Deletes the specified comment ID.
echo $_CORE->Comments->del(999) ? "OK" : $_CORE->error}
Get comment with the specified ID.
$comment = $_CORE->Comments->get(999);
Get all comments for the specified ID.
$comments = $_CORE->Comments->getAll(999);
COMMENTS API FUNCTIONS
http://yoursite.com/api/comments/REQUEST/. These are pretty much a replica of the above library functions, except in REST API format. Feel free to delete
api/API-comments.php if you don’t intend to integrate an API.
Save a comment.
$_POST["id"]– INT, the post/product/video/image ID.
$_POST["message"]– STRING, comment.
$_POST["cid"]– INT, comment ID. Only if updating a comment.
Delete a comment.
$_POST["cid"]– INT, the comment ID.
$_POST["id"]– INT, “item ID”.