• Resolved akhilser

    (@akhilser)


    Hello, I have a from for hiring process . there are some courses in a drop down box , when an user apply for 1 course with his/her email address the form will submit. So i have to block the user for applying same course again with same email address. But he can apply for other courses only 1 course with same email address validation is that possible with Forminator? i tried registration form but it creates a user and the same use cant submit form again ..

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @akhilser

    I hope you are doing well today.

    I pinged our SLS Team so that they can review your query and see what will be possible in this case. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Hi again @akhilser

    We have snippets for one submission per email address. Please add a must-use plugin to your site’s wp-content/mu-plugins folder like this https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins, then add the following code to the plugin’s php file:

    <?php
    /**
     * Plugin Name: [Forminator] - Limit the submition by email.
     * Description: [Forminator] - Limit the submition by email.
     * Author: Thobk @ WPMUDEV
     * Author URI: https://premium.wpmudev.org
     * License: GPLv2 or later
     */
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    } elseif ( defined( 'WP_CLI' ) && WP_CLI ) {
    	return;
    }
    ​
    add_filter( 'forminator_custom_form_submit_errors', function( $submit_errors, $form_id, $field_data_array ){
    	$your_list_forms = [79397];
    	if( empty( $submit_errors ) && in_array( $form_id, $your_list_forms ) ){
    		$your_unique_field_name = 'email-1';
    		$your_error_msg = 'The email is already submitted';
    		foreach( $field_data_array as $field ){
    			if( $field['name'] === $your_unique_field_name ){
    				global $wpdb;
    				$table_meta = $wpdb->prefix . 'frmt_form_entry_meta';
    				$table_entry = $wpdb->prefix . 'frmt_form_entry';
    				if( $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(1) FROM $table_meta as m LEFT JOIN $table_entry as e ON m.entry_id = e.entry_id WHERE m.meta_key = 'email-1' AND m.meta_value=%s AND e.form_id = %d LIMIT 1;", $field['value'], $form_id ) ) ){
    					$submit_errors[][$your_unique_field_name] = $your_error_msg;
    				}
    				break;
    			}
    		}
    	}
    	return $submit_errors;
    }, 10, 3);

    We recommend to test this on the dev/staging version first before putting it on the live site.

    Kind Regards,
    Kris

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @akhilser ,

    We haven’t heard from you for over a week now, so it looks like you no longer need our assistance.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Forminator Email validation For Dropdown values’ is closed to new replies.