Skip to content

Commit 8faffab

Browse files
committed
gw-conditional-logic-entry-meta.php: Fixed issue where entry meta were added twice in Notification and Confirmation conditional logic.
1 parent c0763bd commit 8faffab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gravity-forms/gw-conditional-logic-entry-meta.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Plugin URI: https://gravitywiz.com/
1414
* Description: Use the entry meta in conditional logic (e.g. payment status, approval status, etc).
1515
* Author: Gravity Wiz
16-
* Version: 0.1
16+
* Version: 0.2
1717
* Author URI: https://gravitywiz.com
1818
*/
1919
class GW_CL_Entry_Meta {
@@ -54,7 +54,9 @@ public function output_admin_script() {
5454
const entryOptions = <?php echo json_encode( $this->get_conditional_logic_options() ); ?>;
5555
gform.addFilter( 'gform_conditional_logic_fields', function( options, form, selectedFieldId ) {
5656
for ( const property in entryOptions ) {
57-
if ( entryOptions.hasOwnProperty( property ) ) {
57+
// Entry meta are already added in Notifications and Confirmations conditional logic but not in feeds.
58+
// Let's just make sure that none of our entry meta options have been previously added.
59+
if ( entryOptions.hasOwnProperty( property ) && ! options.find( opt => opt.value === entryOptions[ property ].value ) ) {
5860
options.push( {
5961
label: entryOptions[ property ].label,
6062
value: entryOptions[ property ].value

0 commit comments

Comments
 (0)