Forminator - Possibly custom code needed

1. I would like to limit the number of submissions that can be done in a form
2. Is there is a way to show how many submissions were completed on the front end?

  • Predrag Dubajic

    Hi Alex,

    1. I would like to limit the number of submissions that can be done in a form

    When you go to form settings you will see Form lifespan option and in there you can select "Expires after x-submits" option to limit the number of submissions for that form:

    2. Is there is a way to show how many submissions were completed on the front end?

    This is actually an interesting option and we have added it on our to-do list so devs can add it in one of the future versions :slight_smile:
    In the meantime, I've pinged devs to see if there's a quick way of adding this via shortcode until it's included in the plugin.

    Best regards,
    Predrag

  • Konstantinos Xenos

    Hi Alex ,

    You can add this code that utilizes the Forminator API as shown at the end of this post into your functions.php ( preferably your child-themes ) and then use the [my_form_submissions form_id=85] shortcode anywhere in your website that you want to show the submissions number. You should of course change the '85' with your forms ID that you want to count the submissions.

    I hope this helps!

    Regards,
    Konstantinos

    add_shortcode( 'my_form_submissions', 'my_custom_form_subs' );
    function my_custom_form_subs( $atts ) {
    	$a = shortcode_atts( array( 'form_id' => '' ), $atts );
    
    	if ( ! empty( $a['form_id'] ) && intval( $a['form_id'] ) ) {
    		$count = count( Forminator_API::get_entries( $a['form_id'] ) );
    
    		return $count;
    	} else {
    		return __( 'Please enter a form id' );
    	}
    }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.