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) »
  • civicrm_api3_group_contact_get handles contact_id or group_id but not both
Pages: [1]

Author Topic: civicrm_api3_group_contact_get handles contact_id or group_id but not both  (Read 711 times)

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
civicrm_api3_group_contact_get handles contact_id or group_id but not both
November 29, 2011, 10:38:29 am
Hi,

I found that in 4.0.6, civicrm_api3_group_contact_get handles contact_id or group_id but not both: if you specify contact_id, it ignores group_id.

Use case: using getcount to see if contact X is in group Y. This will return result = 1 regardless of group_id, provided that X is in at least one group. This seems a counter-intuitive result.

Easy enough to work around this by retrieving all the contact's groups and iterating through, but getcount would be a nicer way to do it.

Dave J

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civicrm_api3_group_contact_get handles contact_id or group_id but not both
November 30, 2011, 12:33:01 am
Yeap seems to be a big switch if contact_id is set

would be good if you have a look at civicrm_api3_group_contact_get and patch it.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • civicrm_api3_group_contact_get handles contact_id or group_id but not both

This forum was archived on 2017-11-26.