How do I get the CONSENT Field Description to print on the email notification?

My client would like to have the CONSENT field description print out on the email notification - it currently does not (just shows that submitter checked the “I agree” box). How do I get it to print/be included on email notification?

The consent field description is available via the field-specific merge tag e.g. {consent:1.3}, you would replace 1 with the ID of your field.

Also, if you want to pull the description in when using the {all_fields} merge tag, I’ve used the following snippet before. The snippet requires PHP 8 or greater and adding the modifier {all_fields:show_consent_text}

// show consent field text with modifier {all_fields:show_consent_text}
add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {

    if ( $merge_tag == 'all_fields' && str_contains( $modifier, 'show_consent_text' ) && $field instanceof GF_Field_Consent && $raw_value[ rgars( $field, 'inputs/0/id' ) ] ) {

        return sprintf( '%1$s %2$s<br />%3$s',
            wp_kses_post( $field['checked_indicator_markup'] ),
            wp_kses_post( $field['checkboxLabel'] ),
            wp_kses_post( $field['description'] )
        );

    }

    return $value;

}, 10, 6 );
1 Like

Joshua,

Thank you – I will try this. I tried adding the {consent:1.3} to the Messages field in the Notifications setup (right next to the {all fields}, but that did not work.

Am VERY new to the Gravity universe & realize this is probably 99% me doing things incorrectly. I am going to try what you have recommend below – Just have to check what version of PHP is in place (client using GoDaddy Managed WordPress hosting & am not sure).

Is it ok if I ask further “dumb” questions of you if this doesn’t work?

Regards,

Robin

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.