Skip to content

Instantly share code, notes, and snippets.

@spivurno
Last active September 14, 2021 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/10c51485d70e7ff2fac3cca8a70aedc2 to your computer and use it in GitHub Desktop.
Save spivurno/10c51485d70e7ff2fac3cca8a70aedc2 to your computer and use it in GitHub Desktop.
Gravity Perks // GP Limit Submissions // Apply Limit Feed to Group of Forms
<?php
/**
* Gravity Perks // GP Limit Submissions // Apply Limit Feed to Group of Forms
* http://gravitywiz.com/documentation/gravity-forms-limit-submissions/
*/
add_filter( 'gpls_rule_groups', function( $rule_groups, $form_id ) {
// Update "123" to the ID of your form.
$primary_form_id = 123;
if( $form_id == $primary_form_id || ! in_array( $form_id, array( 124, 125, 126 ) ) ) {
return $rule_groups;
}
$rule_groups = array_merge( $rule_groups, GPLS_RuleGroup::load_by_form( $primary_form_id ) );
foreach( $rule_groups as $rule_group ) {
$rule_group->applicable_forms = false;
}
return $rule_groups;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment