gpls_rule_groups
Description
Filter the rule groups that will be enforced for this form.
Usage
Apply to all forms.
add_filter( 'gpls_rule_groups', 'my_custom_function' );Apply to a specific form.
add_filter( 'gpls_rule_groups_FORMID', 'my_custom_function' );Parameters
$rule_groups array
An array of GPLS_RuleGroup objects.
$form_id int
The current form ID for which rules are being enforced.
Examples
Apply Limit Collectively to Group of Forms
This allows you to apply limits collectively to a group of forms such that other forms will share limits with a Primary Form.
Disable Limit Feeds when Editing via Gravity View
This allows you to disable limit feeds when editing form entries via Gravity View.
<?php
/**
* Gravity Perks // GP Limit Submissions // Disable Limit Feeds when Editing via Gravity View
* https://gravitywiz.com/documentation/gravity-forms-limit-submissions/
*/
add_filter( 'gpls_rule_groups', function( $rule_groups, $form_id ) {
if ( is_callable( 'gravityview_get_context' ) && gravityview_get_context() == 'edit' ) {
$rule_groups = array();
}
return $rule_groups;
}, 10, 2 );Disable Limit Rule for Specific User Role
This allows you to disable the limit submissions feed for users of a specific role.
<?php
/**
* Gravity Perks // GP Limit Submissions // Disable Limits for a Specific User Role
* https://gravitywiz.com/documentaiton/gravity-forms-limit-submissions/
*/
// Update '123' to the ID of the Form.
add_filter( 'gpls_rule_groups_123', function( $rule_groups, $form_id ) {
// Update to the slug of the role, i.e. administrator, editor, author, contributor, subscriber.
$role_to_check = 'administrator';
$user = wp_get_current_user();
if ( in_array( $role_to_check, (array) $user->roles ) ) {
$rule_groups = array();
}
return $rule_groups;
}, 10, 2 );Since
This filter is available since GP Limit Submission 1.0-beta-1.