Comment Approval v0.1Created by: Nick Ramsay
Created on: 2009/02/10
This is just a first version, but give it a try if you're brave. Leave a comment to let me know if it works okay or if I've got some bugs to fix. Sorry for all the edits you have to make, steps 2, 3 and 4 are the main ones. 5, 6 and 7 just stop the comments showing up in the sidebar and Live pages.DescriptionPuts comments from a new user into moderation, and notifies the administrator via email and a "pending" section in Admin.
How it works- The comment form shows the message "Please note that comment moderation is enabled" for users with no previously approved comments.
- When that user submits a comment, it doesn't appear. However, the comment with approve/delete links is sent to 'god' or 'admin' users via email.
- 'god' users can set where they want the email notification to go through the Admin panel.
- The approve/delete links in the email (also shown on pending comments listed in Admin) perform the action in one step - no confirmation step!
- 'admin' users can moderate comments, but are not shown the email notification settings. Only 'god' users see those.
How to change the minimum number of comments needed for auto-approvalOpen comment_approval_settings.php and change the number in the first "define" line. By default, 1 comment must be manually approved before being auto-approved.
Instructions1. Upload the
comment_approval folder to your modules folder. Install it from Module Management in Admin.
2. Add the following at the very bottom of /templates/your_template/comment_form.tpl, just before the closing "fieldset":
{checkActionsTpl location="tpl_comment_form_end"}
3. Open /templates/your_template/comment_show.tpl and add the opening "if" at the very top, and the closing "if" at the very bottom:
{if $comment_status == "approved"}
{/if}
4. Open /libs/comment.php and find:
function fill_smarty($smarty){
Add the following anywhere near the top of that function:
$vars=array('comment_status' => '', 'comment_id' => $this->id);
check_actions('comment_status', $vars);
$smarty->assign('comment_status', $vars['comment_status']);
5. To prevent pending comments showing up in the sidebar, open /sidebar_comments.php and put the following immediately before ORDER BY in the line beginning
$res = AND comment_status != 'pending'
6. To prevent pending comments showing up on the main Live page, open /live2.php and find:
function get_comments($time) {
Add the following immediately before "order by" in the line beginning
$res = AND comment_status != 'pending'
7. To prevent pending comments showing up on the Live Comments page (live_comments.php), find the following:
$rows=$db->get_var("SELECT count(*) as count $from_where $order_by");
$comments=$db->get_results("$select $from_where $order_by LIMIT $offset,$top_users_size");
Replace those two lines with these:
$rows=$db->get_var("SELECT count(*) as count $from_where WHERE comment_status != 'pending' $order_by");
$comments=$db->get_results("$select $from_where WHERE comment_status != 'pending' $order_by LIMIT $offset,$top_users_size");
If you are using the live module:Open /modules/live/live_main.php and find:
function live_get_comments($time) {
Add the following immediately before "order by" in the line beginning
$res = AND comment_status != 'pending'
Revision HistoryNick 2009/02/10 - v0.1 First version