Hi,
I want to be able to moderate all comments attached to nodes apart from those associated with the forums. I am happy for people topost watever they like (within reason!) within the forums, but need tomonitor more carefully what comments are allowed on the front page. I feel like this should be possible, even if it required some hard coding of the forum.module or comments.module... But I'm not quite sure where to start and have only been using Drupal for abour 2 days!?!

Thanks for any help you can provide...

Andy

Comments

andykemp’s picture

Does no-one have any idea if this is possible???

hellata’s picture

You will need to modify the default workflow for all content types except for the forum.

In Drupal 4.5.*, go to Administer | content | configure | default workflow and check the "Moderate" checkbox for the content types you want to have more control over.

In Drupal 4.6.*, go to Administer | content | configure | content types and follow the "configure" links next to the content type names.

andykemp’s picture

I saw this but thought putting things in the moderation queue only applied to publishing a post of this type not the assocaited comments... Is this not how this works?

I want to allow a role to be able to publish these nodes (which I now have up and running), but I want the comments on them to be moderated. However I want the students to be able able to post and comment on the forums...

Does what you have suggested do what I want or am I just a little dense today...

hellata’s picture

- Create a folder named comment_approval under the modules directory in your Drupal installation.

- Paste the code below into a file named comment_approval.module

- Enable this module (administer | modules)

- Give your users permission to both, post comments and post comments without approval (you'll be able to take that away in the next step)

- Go to administer | content | configure | content types, and in the configuration screen for content type(s) you want to restrict, check the moderate comments checkbox.

- Test.


<?php

/**
 * Implementation of hook_help()
 */
function comment_approval_help($section) {
  switch ($section) {
    case 'admin/modules#description': return t('Allows for more granular comment workflow');
  }
}

 
/**
 * Implementation of hook_nodeapi().
 */
function comment_approval_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($op == 'settings') {
      return array('comment_approval'=>form_checkbox('moderate comments', $node->type.'_comment_approval', 1, variable_get($node->type.'_comment_approval', FALSE), 'If the global comment moderation is disabled (the "post comments without approval" option is checked), this checkbox will determine whether the content goes to the moderation queue.', NULL, FALSE));
  }
}


/**
 * Implementation of hook_comment().
 */
function comment_approval_comment($op, $comment) {

  // don't mess with admins and underpriviledged users
  if (user_access('administer comments') || user_access('administer moderation') || user_access('moderate comments') || !user_access('post comments') || !user_access('post comments without approval')) {
    return; 
  }

  $node = node_load(array('nid'=>$comment['nid']));
  
  // put the comment back into the approval queue if the settings say so
  if (($op == 'insert' || $op =='update') && variable_get($node->type.'_comment_approval', FALSE)) {
     db_query("UPDATE {comments} SET status = 1 WHERE cid = %d", $comment['cid']);
     
     drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.'));
  }
}


?>


hellata’s picture

I completely mis-interpreted the problem in the first place.

andykemp’s picture

Thank you you are wonderful! I shall try this when I get into work tomorrow!

emackn’s picture

I needed this for Drupal 5, so I put it in a module.

http://drupal.org/project/split_moderation