You are here

function redhen_contact_user_contact in RedHen CRM 7

Return a RedHen contact associated with a given Drupal account.

Parameters

object $account: User object.

Return value

mixed RedhenContact or FALSE.

1 call to redhen_contact_user_contact()
redhen_org_group_contact_groups in modules/redhen_org_group/redhen_org_group.module
Return all redhen_org groups that a given user belongs to.
1 string reference to 'redhen_contact_user_contact'
redhen_contact_update_7003 in modules/redhen_contact/redhen_contact.install
Create indexes for foreign keys.

File

modules/redhen_contact/redhen_contact.module, line 998
Module file for RedHen contacts.

Code

function redhen_contact_user_contact($account) {
  $contact = FALSE;
  $result = db_select('redhen_contact_user', 'rcu')
    ->fields('rcu', array(
    'contact_id',
  ))
    ->condition('uid', $account->uid)
    ->condition('status', 1)
    ->execute()
    ->fetchCol();
  if ($result) {
    $contact = redhen_contact_load(reset($result));
  }
  return $contact;
}