Different notifications / confirmations based on amount of submitted entries

Hello,

we currently have a form to register for an event where capacity is limited (e.g. only 18 people can attend).

We would like to display different form confirmations and send different email notifications depending on how many forms have already been submitted.

For example, only 5 people have registered so far, so there is still enough capacity for more people to register. Therefore, the person who has registered will receive a confirmation that they can attend the event.
However, the 19th person who registers should receive a confirmation that they have been put on the waiting list and also receive another email.

Is there any way to achieve this behaviour? As far as I know, the conditional logic only allows checking the values of fields from the submitted form, but not other values such as the total number of registrations.

Many thanks in advance!

Hi Dominic. There are several ways to do this. Here is one I just tested.

First, grab the free code from here:

That is PHP code that can be added to your theme functions.php file, or you can use a plugin such as this one to keep the code separate from the theme: Code Snippets – WordPress plugin | WordPress.org

Then, add a snippet like this, which will get the number of entries that exist right when the form is submitted, and store that in field 4 (in my form.)

// relies on the code from here:
// https://gravitywiz.com/shortcode-display-number-entries-submitted/
// apply to form ID 176 only
add_action( 'gform_pre_submission_176', 'how_many_entries' );
function how_many_entries( $form ) {
    // where do you want to store the number of entries
	$entry_count = do_shortcode('[gravityforms action="entry_count" id="176" format="decimal"]');
    $_POST['input_4'] = $entry_count;
}

That code will apply to form 176 on my site, and it will store the number of entries in field 4. Field 4 is a number field with the visibility hidden on my site.

When the form is submitted, field 4 will get the number of entries that existed before that entry was created, and you can base your conditional notification and conditional confirmation message on that field.

If you have any questions, please let us know.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.