bookmark_bordergform_ip_address

Description

Allows the IP address of the client to be modified.

Use this filter if the server is behind a proxy.

Usage

add_filter( 'gform_ip_address', 'your_function_name' );

Parameters

  • $ip string

    The IP being used.

Example

Use this if you are behind a proxy. This example will use HTTP_X_FORWARDED_FOR, allowing the visitor IP to be displayed instead of the proxy IP.

add_filter( 'gform_ip_address', 'filter_gform_ip_address' );

function filter_gform_ip_address( $ip ) {
	// Return the IP address set by the proxy.
	// E.g. $_SERVER['HTTP_X_FORWARDED_FOR'] or $_SERVER['HTTP_CLIENT_IP']
	return $_SERVER['HTTP_X_FORWARDED_FOR'];
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

  • 2.2

    Introduced.

Source Code

This filter is located in forms_model.php