You are here

function crm_core_user_sync_get_contact_type_for_account in CRM Core 8.2

Same name and namespace in other branches
  1. 7 modules/crm_core_user_sync/crm_core_user_sync.module \crm_core_user_sync_get_contact_type_for_account()

Returns corresponding contact type for user account to synchronize with.

1 call to crm_core_user_sync_get_contact_type_for_account()
crm_core_user_sync_sync in modules/crm_core_user_sync/crm_core_user_sync.module
Synchronizes user amd contact.

File

modules/crm_core_user_sync/crm_core_user_sync.module, line 188

Code

function crm_core_user_sync_get_contact_type_for_account($account) {
  $rules = variable_get('crm_core_user_sync_rules', array());
  uasort($rules, 'crm_core_user_sync_weight_cmp');
  foreach ($rules as $rule) {
    if ($rule['enabled'] && in_array($rule['rid'], array_keys($account->roles))) {
      return $rule['contact_type'];
    }
  }
  return FALSE;
}