Scope Feeds to the Current Nested Forms Parent Entry.
Set GP Limit Submissions feed to only apply to child entries submitted for the same parent entry.
Code
Filename: gpls-scope-feed-to-current-parent-entry.php
<?php
/**
* Gravity Perks // Limit Submissions // Scope Feeds to the Current Nested Forms Parent Entry.
* https://gravitywiz.com/documentation/gravity-forms-limit-submissions/
*
* Set GP Limit Submissions feed to only apply to child entries submitted for the same parent entry.
*/
add_action( 'gpls_before_query', function( $ruletest ) {
global $wpdb;
$parent_form_id = rgpost( 'gpnf_parent_form_id' );
// Update "123" to your child form ID.
if ( $ruletest->form_id == 123 && class_exists( 'GPNF_Session' ) && $parent_form_id ) {
$gpnf_session = new GPNF_Session( $parent_form_id );
$ruletest->join[] = "INNER JOIN {$wpdb->prefix}gf_entry_meta em_gpnf ON em_gpnf.entry_id = e.id";
$ruletest->where[] = sprintf( "\n( em_gpnf.meta_key = '%s' AND em_gpnf.meta_value = '%s' )", GPNF_Entry::ENTRY_PARENT_KEY, $gpnf_session->get( 'hash' ) );
}
} );