Answers.Body: <p>Use <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pre" rel="nofollow">hook_civicrm_pre</a> to modify the group-to-be prior to saving in the database.  Experiment a little with your hook function, adding the debug lines:</p>
  
  <pre><code>if ($op == 'create' &amp;&amp; $objectName == 'Group') {
    print_r($params);
    die();
  }
  </code></pre>
  
  <p>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!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-10T06:02:47.870Z
Answers.Text: 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!)
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-10T06:01:22.243Z
Answers.LastActivityDate: 2015-08-10T06:01:22.243Z
Answers.UserDisplayName: Andie Hunt
Body: <p>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 <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference" rel="nofollow">hooks?</a></p>
  
Tags: <extension><groups><hooks><mailing>
Title: How can I make every new Group a type Mailing List?
ThreadText: # How can I make every new Group a type Mailing List?
  
  (Asked by: username_0 on 2015-08-10)
  
  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?](http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference)
  
  **Tags:** extension, groups, hooks, mailing
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-10. Score: 4
  
  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') {
    print_r($params);
    die();
  }
  
  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!
  
  > **Comments:**
  > **username_1**: 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!)  
  
  ---
  
  