Hello,

I've been searching far and wide for a module will allow me to set the comments to read only after a user defined number. This option would appear on the content creation page under comment settings. I know some programming but I need to help on where to start. Is there a module that curretly modifies anything to do with the comment settings that I could use as a reference?

Would this be super difficult to do?

Any help pointing me in the right direction would be greatly appreciated. I'm currently creating the generic holder for this module using the documentation provided.

Drupal rocks!

Thanks.

Comments

WorldFallz’s picture

you can ignore my email, I found your thread (obviously, lol). imo the best way to do this would be with the incredibly powerful workflow_ng module.

Install the module, then:

  1. create a new rule configuration for event "Comment has been created"
  2. add a new condition, select Workflow-ng "Execute custom PHP code"
  3. enter the following as the custom code:
    return $node->comment_count == 4;
    

    where "4" can be any number of comments you want. Keep in mind it's disabling the comments AFTER the comment is created so setting comment count to 4 will allow you have 5 comments, setting it to 99 will allow you have 100 comments, etc.

  4. add a new action, select Workflow-ng "Execute custom PHP code"
  5. enter the following as the custom code:
    $node->comment = 1;
    return array("node" => $node);
    

Test it out. You can also add whatever other conditions workflow-ng provides that you want (certain node type, user roles, etc).

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

Grimlock’s picture

Awesome, thanks a million once again. I need to learn PHP fast like and quit hacking stuff so much, I would be done with things years faster :). Thank you!

WorldFallz’s picture

excellent-- happy to help.

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

nelslynn’s picture

Can someone please help me with the Workflow_ng condition to get the comment count per author, per node? I want to limit one comment per author, per node.

Thanks,

VeeLin’s picture

Hello,

I am trying to do the same thing for a node that is linked to another node:
So I have node A and node B. A is linked to B using the reference/referrer modules. So B can only be created from A. Now I want to limit it so each A can only have one B. If a user tries to create a second B for that node then I want them to be re-directed to the existing B.

Any help with this would be greatly appreciated. I understand the principle but need some help with the PHP code.

V

madaxe’s picture

This doesn't seem to work with rules in Drupal 6.