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) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Fetch all emails - not only primary - for a contact
Pages: [1]

Author Topic: Fetch all emails - not only primary - for a contact  (Read 917 times)

marc

  • Guest
Fetch all emails - not only primary - for a contact
February 15, 2010, 08:25:18 am
Hi,

I just used CRM_Contact_BAO_Contact::getContactDetails( $userID ) to fetch the email, displayname etc for a contact, but looking at the code it seems that it only gets the primary email of the contact. Is there a way to fetch the other emails (if they exist) quickly? And if not, is there a quick way in which I could customise getContactDetails such that it does fetch them all?

I don't mind messing around a little with this, if someone who knows the method better thinks it's possible. By default, it probably should only fetch the primary email, but it would be a nice feature to be able to fetch them all by passing the appropriate params.

Marc

Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Fetch all emails - not only primary - for a contact
February 18, 2010, 04:59:38 am
Would a call to CRM_Core_BAO_Email::allEmails($contact_id) work for you?
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

marc

  • Guest
Re: Fetch all emails - not only primary - for a contact
February 18, 2010, 07:22:39 am
Yep, that one does the job.

Thanks

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Fetch all emails - not only primary - for a contact
February 18, 2010, 09:16:28 am
Hi,

What about providing it as a patch on the send an email activity, so you can use any of your emails ?

(wasn't it like that in a 2.x verrsion ?)

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) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Fetch all emails - not only primary - for a contact

This forum was archived on 2017-11-26.