I have a content type which can be flagged by users. I want to permit writing comments only users who flagged the node. Is it possible? How to do that?
Will appreciate help.
thx

Comments

rameshbabu.g’s picture

Hi,

By default set the comment of your content type disable mode.When loading a particular node hook_node_load, check whether the node is flagged or not like below if not set the node comment value 2 otherwise by default it is 1

$flag = flag_get_flag('your flag name') or die('no "bookmarks" flag defined');

if ($flag->is_flagged($node->nid)) {
  $node->comment = 2;
}