1

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

EDIT

There is a CiviCRM API. My code so far:

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

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

2
  • 1
    Please do not edit answers into question. Post them as answers. I rolled back that edit, since it shouldn't happen.
    – Mołot
    Commented Nov 6, 2014 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
    Commented Nov 6, 2014 at 23:48

1 Answer 1

2

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 and acknowledge you have read our privacy policy.

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