Description
The wsf_submit_block_ips filter hook enables you to specify an array of blocked IP addresses that are checked when a form is submitted. WS Form will check the users IP address when the form is rendered. If a blocked IP address is found the form won’t be rendered and an optional message will be shown.
By default this filter hook applies to all forms. You can restrict this filter hook to a specific form by checking the $form->id
parameter.
Note that IP address blocking is not processed when previewing a form.
Usage
add_filter( 'wsf_submit_block_ips', 'my_hook_function', 10, 2 );
Parameters
$ips
ArrayAn array of IP addresses to block. These can be IPv4 or IPv6 addresses.$form
Form ObjectThe form object.
Example
// Callback function for the wsf_submit_block_ips filter hook function my_hook_function( $ips, $form, $submit ) { // IPs to block $ips[] = '192.0.2.0'; $ips[] = '2001:db8::'; // Return value return $ips; } // Add a callback function for the wsf_submit_block_ips filter hook add_filter( 'wsf_submit_block_ips', 'my_hook_function', 10, 3 );
Source File
This hook can be found in:<plugin root>/includes/core/class-ws-form-form.php