Drupal only allows the Admin user to view unpublished comments. I want to allow the node:author to be able to view the unpublished comments as well but no other users with the same role.

I have looked at the comments.module file and found a number of functions that should help but I cannot get my code to work. This is my latest attempt. I would think it should work.... but it does not.

I tried this code but it did not do much. I put it in my custom template file comment-wrapper--node-my-custom-node.tpl.php

if ($node->uid == $user->uid){   
  $subject2 = db_query('SELECT nid, cid, subject, name FROM {comment} WHERE status = :status',
      array(
        ':status' => COMMENT_NOT_PUBLISHED,
         )
      )->fetchField();   
  print render($subject2);
    }

Can someone please tell me how to display all of the unpublished comments for the node?

Comments

Comment Access

Have you looked at the Comment Access (http://drupal.org/project/commentaccess) module? or Comment Publish (http://drupal.org/project/comment_publish)?

Comment access

Thanks,

Comment access did what I needed. :)

Spineless