The unique key is email address. Perhaps there is a CiviCRM API?


There is a CiviCRM API. My code so far:

$content = civicrm_api('contact', 'getvalue', array(
  'email' => $GLOBALS['user']->mail,
  'version' => 3,
  'return' => 'first_name')

I need the user's group, not first name.

  • 1
    Please do not edit answers into question. Post them as answers. I rolled back that edit, since it shouldn't happen. – Mołot Nov 6 '14 at 15:50
  • I think you want to find all of the groupContact records for a given contact. See documentation at d45.demo.civicrm.org/civicrm/api/doc#GroupContact – Joe Murray Nov 6 '14 at 23:48

You can even use 'email' api to get the contact id(as you have the email address in $GLOBALS['user']->mail) and then use 'GroupContact' api as above to get the groups record.

$result = civicrm_api3('Email', 'get', array(
  'sequential' => 1,
  'return' => "contact_id",
  'email' => $GLOBALS['user']->mail,

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.