function crm_core_user_sync_validate in CRM Core 8.2
Same name and namespace in other branches
- 7 modules/crm_core_user_sync/crm_core_user_sync.module \crm_core_user_sync_validate()
Validates user amd contact.
Parameters
$account to be synchronized:
$contact_type to be associated with $account. It can be contact object either.:
1 call to crm_core_user_sync_validate()
- 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 225
Code
function crm_core_user_sync_validate($account, $contact_type) {
if (is_object($contact_type)) {
$contact_type = $contact_type->type;
}
$rules = variable_get('crm_core_user_sync_rules', array());
foreach ($rules as $rule) {
if ($rule['enabled'] && in_array($rule['rid'], array_keys($account->roles)) && $rule['contact_type'] == $contact_type) {
return TRUE;
}
}
return FALSE;
}