Skip to content

Instantly share code, notes, and snippets.

@saifsultanc
Created April 3, 2025 05:07
Show Gist options
  • Save saifsultanc/31e9adb940070aa083c203969f233c30 to your computer and use it in GitHub Desktop.
Save saifsultanc/31e9adb940070aa083c203969f233c30 to your computer and use it in GitHub Desktop.
custom-snippet-79632.php
<?php
add_filter( 'gform_replace_merge_tags', function ( $text, $form, $entry ) {
$pick = '';
if ( $text == '@{:1} @{:3} @{:10}' ) {
$trigger_field_id = 8;
$trigger_field_value = rgpost( 'input_' . $trigger_field_id );
if ( $trigger_field_value == 'First Choice' ) {
$pick = '1';
} else if ( $trigger_field_value == 'Second Choice' ) {
$pick = '3';
} else if ( $trigger_field_value == 'Third Choice' ) {
$pick = '10';
} else {
$pick = '';
}
}
if ( $pick ) {
return rgpost( 'input_' . $pick );
}
return $text;
}, 9, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment