Limit User Submission To Max 4 Submits Per Id (Not IP)
-
<?php add_filter( 'forminator_render_form_markup', function( $html, $form_fields, $form_type, $form_settings, $form_design, $render_id ) { if ( is_user_logged_in() ) { global $wpdb; $user_id_field_name = 'hidden-1'; $user_id = get_current_user_id(); $message = __( 'You can submit this form only once' ); $user_entries = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(e.entry_id) FROM {$wpdb->prefix}frmt_form_entry as e INNER JOIN {$wpdb->prefix}frmt_form_entry_meta as m ON e.entry_id=m.entry_id WHERE m.meta_key=%s AND m.meta_value=%d LIMIT 1", $user_id_field_name, $user_id ) ); if ( ! empty( $user_entries ) || 0 < $user_entries ) { return $message; } }
I have checked this code. This code is running but this script is running for just 1 time form submission. I want that same script to 4 times then say something to the user that you are not allowed to fill the form 5 time.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Limit User Submission To Max 4 Submits Per Id (Not IP)’ is closed to new replies.