cs_validate_contact_account
Estimated reading: 1 minute
add_filter( 'cs_validate_contact_account', 'custom_contact_account' );
//You can also use a Gravity Forms form ID to target a specific form
add_filter( 'cs_validate_contact_account_6', 'custom_contact_account' );PHP
Parameters
- $contact_account ( array )
This array passes the displayed contact and account arrays. This value must be returned in the filter function. - $payer ( object )
This is the full object of the CampaignSuite Payer class. This object contains various additional information about the payer.
Example
add_filter('cs_validate_contact_account', 'validate_contact_account', 10, 2);
function validate_contact_account($contact_account, $payer)
{
[$contact, $account] = $contact_account;
if (isset($contact['Phone']) && !empty($contact['Phone'])) {
if (isMobile($contact['Phone'])) {
$contact['MobilePhone'] = $contact['Phone'];
unset($contact['Phone']);
}
}
if ($payer->accountRecordType != 'Household') {
$contact['soco__Assign_Donations_to_Parent_Account__c'] = true;
} else {
$contact['soco__Assign_Donations_to_Parent_Account__c'] = false;
}
return [$contact, $account];
}PHP