• Great plugin, but I (like others, apparently) needed support for the {all_fields} merge tag. Add this code to your theme’s functions.php file to have the Description field appended with what GF would normally put in that merge tag. (Note, this doesn’t add support for {all_fields}, since that appears to be stripped out before this filter fires… it just appends it to the end of the description field, which is the most likely use case)

    add_filter('crmperks_gf_zendesk_post', 'support_all_fields', 10, 3);
    
    function support_all_fields($temp, $feed, $entry)
    {
    	$form = GFAPI::get_form($entry['form_id']);
    	
    	$retval = GFCommon::replace_variables('{all_fields}', $form, $entry, $url_encode = false, $esc_html = true, $nl2br = true, $format = 'html', $aux_data = array());
    	
    	$retval = str_replace(array("\r", "\n"), '', $retval);
    	
    	if(is_array($temp['comment']))
    	{
    		$val = $temp['comment']['value'];
    	}
    	
    	$val .= $retval;
    	
    	$temp['comment'] = array(
    		'value' => $val,
    		'label' => 'Description'
    	);
    	
    	return $temp;
    }

The topic ‘Snippet for {all_fields} support’ is closed to new replies.