Last active
April 5, 2022 13:19
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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