CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Use civicrm_api() to retrieve only mailing list groups
Pages: [1]

Author Topic: Use civicrm_api() to retrieve only mailing list groups  (Read 1124 times)

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Use civicrm_api() to retrieve only mailing list groups
September 15, 2011, 08:00:45 pm
Mailing list groups contain a '2' in their group_type value.

If an ACL group, civicrm_group.group_type = "1"
If only a mailing_list, civicrm_group.group_type = "2".
If both, civicrm_group.group_type = "12".
If neither, civicrm_group.group_type is empty (or null, or whatever it is).

Retrieving mailing lists only (2 but not 12) looks like this -
Code: [Select]
  $groups = civicrm_api("Group","get", array('group_type' => 2, 'version' =>'3'));

I want to retrieve the second and third group types, where group_type contains a 2.

How do I do this with civicrm_api()?
@xurizaemon ● www.fuzion.co.nz

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Use civicrm_api() to retrieve only mailing list groups
September 15, 2011, 08:28:54 pm
Hi,

I don't think there is a way at the moment. It would be fairly easy to add into group api but you'd want a test so you know it will still work next upgrade...

Happy to commit a patch on it...
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Use civicrm_api() to retrieve only mailing list groups

This forum was archived on 2017-11-26.