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 (Moderator: Donald Lobo) »
  • can civicrm_contact_search( ) return non primary email?
Pages: [1]

Author Topic: can civicrm_contact_search( ) return non primary email?  (Read 1093 times)

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
can civicrm_contact_search( ) return non primary email?
October 15, 2008, 01:11:59 am
I'm using civicrm_contact_search() to extract a list of emails from a smart group as shown below:

Code: [Select]
  // Set search criteria
  $params['rowCount'] = 50000;
  $params['sort'] = 'sort_name ASC';
  $params['return.display_name'] = 1;
  $params['return.email'] = 1;
  $groups = array($GroupId => 1);
  $params['group'] = $groups;
  $result = civicrm_contact_search( $params );

This works fine and returns the primary email for all the contacts in the group. However I want to extract both primary and other emails associated with the contact. Can I use civicrm_contact_search() or do I need to hard code my sql?

Thanks, Henry

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: can civicrm_contact_search( ) return non primary email?
October 15, 2008, 07:13:12 am

You will need to hardcode the sql, alternatively u can call the function:

CRM_Contact_BAO_Contact_Location::getEmailDetails

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • can civicrm_contact_search( ) return non primary email?

This forum was archived on 2017-11-26.