{"id":4344,"date":"2024-04-01T20:10:05","date_gmt":"2024-04-01T18:10:05","guid":{"rendered":"https:\/\/www.knowboard.de\/?p=4344"},"modified":"2024-04-01T20:10:09","modified_gmt":"2024-04-01T18:10:09","slug":"forminator-prevent-multiple-submissions-from-same-email","status":"publish","type":"post","link":"https:\/\/www.knowboard.de\/forminator-prevent-multiple-submissions-from-same-email\/","title":{"rendered":"Forminator: Prevent multiple submissions from same email"},"content":{"rendered":"\n
add_filter('forminator_custom_form_submit_errors', function( $submit_errors, $form_id, $field_data_array ) {\n    global $wpdb;\n\n    \/\/ Retrieve the email value from the form field\n    $form_email = $field_data_array[1]['value'];\n\n    $sql = $wpdb->prepare(\n        \"SELECT COUNT(*)\n        FROM {$wpdb->prefix}frmt_form_entry_meta\n        WHERE meta_value = %s\",\n        $form_email\n    );\n\n    $results = $wpdb->get_results($sql);\n\n    if (!empty($results) && $results[0]->{'COUNT(*)'} > 0) {\n        $submit_errors[]['email-1'] = __( 'The email provided already exists.' );\n        return $submit_errors;\n    }\n}, 10, 3 );<\/code><\/pre>\n\n\n\n

https:\/\/medium.com\/@akshayharshan97\/enhancing-forminator-custom-form-validation-with-the-forminator-custom-form-submit-errors-filter-35b2ede40437<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

https:\/\/medium.com\/@akshayharshan97\/enhancing-forminator-custom-form-validation-with-the-forminator-custom-form-submit-errors-filter-35b2ede40437<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[76],"tags":[],"class_list":["post-4344","post","type-post","status-publish","format-standard","hentry","category-forminator","entry","no-media"],"_links":{"self":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4344"}],"collection":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/comments?post=4344"}],"version-history":[{"count":1,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4344\/revisions"}],"predecessor-version":[{"id":4347,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4344\/revisions\/4347"}],"wp:attachment":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/media?parent=4344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/categories?post=4344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/tags?post=4344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}