0
votes

so i currently have gravity forms installed with a number of different forms. I want users to be able to see all the forms but only able to submit a maximum of 3. I found Gravity Wiz Limit submissions, im able to limit the email address to being used 3 times but this is only working for 1 form, i need it to allow users to submit 3 different forms (eg. a global limitation)

https://gist.github.com/spivurno/4024361

having looked through this and then finding

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 ) {
        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 );

and

add_filter( 'gpls_apply_limit_per_form', '__return_false' );

it looks like its possible but how can i implement this ?

1
If you're a Gravity Perks customer (or become one), we'll be happy to provide support via the support form. - Dave from Gravity Wiz
Hi david, the full perks package is just too expensive. sorry - Dylan Marshall
You won't need the full package, you can get a single perk for $49. - Dave from Gravity Wiz

1 Answers

0
votes

Is it for a user or guest or both? By user you could create a user meta and then use the gform_after_submission to add to the meta. Then use a pre_render to check and see if they are maxed out, and redirect them if they are.

add_action( 'gform_after_submission_{form_id}', 'after_submit_{form_id}', 10, 2 );
function after_submit_{form_id}( $entry, $form, $field ) {

$user_id = get_current_user_id();
$meta_key = 'count_submissions';

$get_meta = get_user_meta($user_id, $meta_key, true);
$qty = $get_meta + 1;

update_user_meta( $user_id, $meta_key, $qty );
}

If you need both, you might just create a database table and collect IPs and a submission count. Then update that on submission.