I'm using the 'comment permissions' module to restrict standard 'authenticated' users from commenting on a particular node type. However I do not want them to bee able to see comments on that node either.

I want to use the commenting system as tool for discussing posts internally. So admins can discuss posts by standard users. I DO want standard users to be able to comment on some other node types.

Obviously it is very important that the author never sees these comments. 'Comment permissions' doesn't have a way to handle this part so I have overridden the node.tpl.php file and only show comments if a certain role is present (see below)

My question is; how bullet proof is this method? Can anyone suggest a better way to achieve this? Obviously a change in theme would reveal comments but are there other issues I'm not thinking of?

<?php if ( (in_array('staff', $user->roles)) || (in_array('administrator', $user->roles)) ){ ?>

// show comments 

<?php } ?>

1 Answer 1


You could make a module that uses hook_comment_load() to do that user role check.


  • That would fix the theme switching i guess. For some reason I feel slightly more secure knowing the node.tpl.php file has been altered directly... Neither solution is 100% ideal i guess it's just a question of which one is safer. I haven't made too many custom modules... are there instances in which they break or are disabled? Jan 28, 2015 at 16:01
  • aside from redundancy, there's really no reason you couldn't do both if you wanted to. however, doing it with that particular hook would mean the comment wouldn't get loaded at all, so I guess it would be "safer"
    – user5482
    Jan 28, 2015 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.