Can I limit form submissions from the same IP / User?

I wanted to know if there was a script/code that could be implemented to achieve sometime of function that one would select something along the lines of " Limit the number of form submissions from the same IP to then set that number?

Reason for asking is because I have customers/clients that keep re-submitting after the first time being a problem because I then don’t know if there form request was first or last.

Yes, I think this free plugin will do exactly what you need to do:

I followed the code and set the limits to 1 for subscribers and contributors, for a specific form:

/* START Submission Limit - ray 09-10-2021*/
new GW_Submission_Limit( array(
‘form_id’ => 4,
‘limit_by’ => ‘role’,
// when “limit_by” is set to “role”, “limit” must be provided as array with roles and their corresponding limits
‘limit’ => array(
‘subscriber’ => 1,
‘contributor’ => 1
)
) );
/* END Submission Limit - ray 09-10-2021*/

However, it threw an error message. It doesn’t like “GW_Submission_Limit”. What am I missing?:

Error Details

An error of type E_ERROR was caused in line 56 of the file /home/namasco/public_html/wp-content/themes/dt-the7/functions.php. Error message: Uncaught Error: Class ‘GW_Submission_Limit’ not found in /home/namasco/public_html/wp-content/themes/dt-the7/functions.php:56
Stack trace:
#0 /home/namasco/public_html/wp-settings.php(546): include()
#1 /home/namasco/public_html/wp-config.php(89): require_once(’/home/namasco/p…’)
#2 /home/namasco/public_html/wp-load.php(50): require_once(’/home/namasco/p…’)
#3 /home/namasco/public_html/wp-admin/admin-ajax.php(22): require_once(’/home/namasco/p…’)
#4 {main}
thrown

Did you implement the full code snippet available when clicking the show code or download code buttons? Or just the configuration portion?

Based on that error, I’d assume the GW_Submission_Limit class isn’t be instantiated because it’s missing.

1 Like

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