Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active April 5, 2022 13:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cliffordp/0d45eae807c190fed0a95de66a655224 to your computer and use it in GitHub Desktop.
Save cliffordp/0d45eae807c190fed0a95de66a655224 to your computer and use it in GitHub Desktop.
Gravity Forms Zoho CRM Add-On -- Decode HTML when sending to Zoho CRM so links work, such as link to the entry
<?php
/**
* Gravity Forms Zoho CRM - Decode HTML for Task Description & Lead Description so links work, such as link to the entry.
*
* @link https://gist.github.com/cliffordp/0d45eae807c190fed0a95de66a655224 This snippet.
* @link https://docs.gravityforms.com/gform_merge_tag_filter/#9-decode-modifier Alternative is to use a modifier like {entry_url:decode}
*/
add_filter( 'gform_zohocrm_task', 'cliff_zoho_crm_task_decode_description', 10, 4 );
if(
! function_exists( 'cliff_zoho_crm_task_decode_description' )
&& function_exists( 'gf_zohocrm' )
) {
/**
* Decode HTML special characters before sending to Zoho CRM Task Description.
*/
function cliff_zoho_crm_task_decode_description( $task, $feed, $entry, $form ) {
gf_zohocrm()->log_debug( __METHOD__ . '():Original Description: ' . $task['Description'] );
$task['Description'] = htmlspecialchars_decode( $task['Description'] );
gf_zohocrm()->log_debug( __METHOD__ . '():Decoded Description: ' . $task['Description'] );
return $task;
}
}
add_filter( 'gform_zohocrm_lead', 'cliff_zoho_crm_lead_decode_description', 10, 4 );
if(
! function_exists( 'cliff_zoho_crm_lead_decode_description' )
&& function_exists( 'gf_zohocrm' )
) {
/**
* Decode HTML special characters before sending to Zoho CRM Lead Description.
*/
function cliff_zoho_crm_lead_decode_description( $lead, $feed, $entry, $form ) {
gf_zohocrm()->log_debug( __METHOD__ . '():Original Description: ' . $lead['Description'] );
$lead['Description'] = htmlspecialchars_decode( $lead['Description'] );
gf_zohocrm()->log_debug( __METHOD__ . '():Decoded Description: ' . $lead['Description'] );
return $lead;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment