I have a request to enable making every new Group created (using search results -> Actions -> Add Contacts to Group) a group type Mailing List by default, thereby saving a user having to check the box next to Mailing List. Can I do that with a new extension, using one of these hooks?

1 Answer 1


Use hook_civicrm_pre to modify the group-to-be prior to saving in the database. Experiment a little with your hook function, adding the debug lines:

if ($op == 'create' && $objectName == 'Group') {

Try creating a group with the Mailing List checked and then creating a group with it not checked to see what it passes. Write your code so that the $params array on a group where Mailing List is not checked ends up looking like the case where it is checked. And obviously delete your debug!

  • 2
    Oh, and publish the extension when you're done. I bet many people would like it. (Though you do need to be careful about access control groups also being mailing list groups--people can unsubscribe themselves out of permissions!)
    – Andie Hunt
    Aug 10, 2015 at 6:02

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.