Skip to content

Commit aa92f1f

Browse files
authored
gpnf-prevent-exporting-orphaned-entries-with-gravityexport.php: Added new snippet.
1 parent bf4e69e commit aa92f1f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Gravity Perks // Nested Forms // Prevent Exporting Orphaned Entries with GravityExport
3+
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
4+
*
5+
* Prevents exporting orphaned entries when using GravityExport with Nested Forms. Applies to all forms by default.
6+
*
7+
* Instructions
8+
*
9+
* 1. Install the snippet.
10+
* https://gravitywiz.com/documentation/managing-snippets/#where-do-i-put-snippets
11+
*
12+
* 2. Profit.
13+
*/
14+
add_filter( 'gfexcel_output_rows', function( $rows ) {
15+
for ( $i = count( $rows ) - 1; $i >= 0; $i-- ) {
16+
foreach ( $rows[ $i ] as $row_value ) {
17+
if ( $row_value->getField()->id == 'gpnf_entry_parent' && ! is_numeric( $row_value->getValue() ) ) {
18+
unset( $rows[ $i ] );
19+
}
20+
}
21+
}
22+
return $rows;
23+
} );

0 commit comments

Comments
 (0)