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?

1 Answer 1

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.

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

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.