1

On our Drupal 6 site we are looking at setting up this rule for comments:

1) If you don't have an approved (i.e. published) comment then your comment goes into the moderation queue

2) If you have an approved comment, then your comment is published straightaway

Is it best to use Rules in Drupal? How can we check how many published comments a user has? Custom PHP code perhaps?

Any help appreciated!

1 Answer 1

1

You do not have to execute a rule every time a user submits a comment. If you have approved a comment for the user, then the permissions systems can handle it.

First create a new role 'Comments approved' and give the role a single permission to 'Publish comments without approval'.

Then create a rule triggered on the event 'After publishing a comment'. Have the rule perform the 'Add user role' action giving the comment author the Comments approved role.

This will mean that the user will be able to publish comments after you have approved their first one, and you will be able to remove the role from the user if they abuse the privilege.

If you want to get really fancy, create another role called 'Moderation only' with no additional permissions. If you have to control comments from a particular user, assign them this role, and in the conditions for the rule, check to see if they are a 'Moderation only' user, and do not assign the 'Comments approved' role if the 'Moderation only role' is present.

1
  • Thats a great answer Triskelion! I will try it out.
    – Jono
    Commented Apr 11, 2013 at 16:00

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.