add_action('forminator_form_after_handle_submit', 'wpmudev_uploaded_filename_fix', 10, 2); add_action('forminator_form_after_save_entry', 'wpmudev_uploaded_filename_fix', 10, 2); function wpmudev_uploaded_filename_fix($form_id, $response) { if ( $form_id…
Forminator: Prevent multiple submissions from same email
add_filter('forminator_custom_form_submit_errors', function( $submit_errors, $form_id, $field_data_array ) {
global $wpdb;
// Retrieve the email value from the form field
$form_email = $field_data_array[1]['value'];
$sql = $wpdb->prepare(
"SELECT COUNT(*)
FROM {$wpdb->prefix}frmt_form_entry_meta
WHERE meta_value = %s",
$form_email
);
$results = $wpdb->get_results($sql);
if (!empty($results) && $results[0]->{'COUNT(*)'} > 0) {
$submit_errors[]['email-1'] = __( 'The email provided already exists.' );
return $submit_errors;
}
}, 10, 3 );
Dieser Beitrag hat 0 Kommentare