2

I wonder how I may preset the mailinglist group type checkbox in group's edit form for new groups.

From a quick glance to code and db I assume that the is_default field in the db is not used here (have tried also).

So how could I do if I want to avoid a client side/js hack?

5

I would create a custom extension as explained here or using an existing one and implementing hook_civicrm_buildForm

Updated

function myextension_civicrm_buildForm( $formName, &$form ) {
  if ("CRM_Group_Form_Edit" == $formName) {
    if ($form->getAction() == CRM_Core_Action::ADD) {
      $defaults = array ("group_type[2]" => true);
      $form->setDefaults($defaults);
    }
  }
}

That will make the Mailing list checkbox checked by default.

  • works like a charm, thx – nielo Jan 21 '16 at 18:39
  • This leads to checked ćheckbox when editing existing groups too – which looks like if a non-mailinglist were a mailinglist. – nielo Mar 17 '16 at 10:08
  • Re-accepted :) Thanks a load! – nielo Mar 17 '16 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.