diff --git a/classes/controllers/FrmAppController.php b/classes/controllers/FrmAppController.php index 879a25a942..3f9673fbc8 100644 --- a/classes/controllers/FrmAppController.php +++ b/classes/controllers/FrmAppController.php @@ -649,8 +649,6 @@ public static function admin_init() { FrmInbox::maybe_disable_screen_options(); } - - self::maybe_add_ip_warning(); } /** @@ -676,65 +674,6 @@ private static function trigger_page_load_hooks() { } } - /** - * Show a warning for the IP address setting if it hasn't been set. - * - * @since 6.1 - * - * @return void - */ - private static function maybe_add_ip_warning() { - $settings = FrmAppHelper::get_settings(); - if ( false !== $settings->custom_header_ip ) { - // The setting has been changed from the false default (to either 1 or 0), so stop showing the message. - return; - } - - if ( ! self::is_behind_proxy() ) { - // This message is only applicable when using a reverse proxy. - return; - } - - if ( FrmAppHelper::get_post_param( 'frm_action', '', 'sanitize_text_field' ) ) { - // Avoid the message on a POST action. We don't want to show the message if we're saving global settings. - return; - } - - $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip'; - $message = sprintf( - // Translators: 1: Global Settings Link - __( 'IP addresses in form submissions may no longer be accurate! If you are experiencing issues, we recommend going to %1$s and enabling the "Use custom headers when retrieving IPs with form submissions." setting.', 'formidable' ), - '' . __( 'Global Settings', 'formidable' ) . '' - ); - $option_name = 'frm_dismiss_ip_address_notice'; - FrmAppHelper::add_dismissable_warning_message( $message, $option_name ); - } - - /** - * Check if any reverse proxy headers are set. - * - * @since 6.1 - * - * @return bool - */ - private static function is_behind_proxy() { - $custom_headers = FrmAppHelper::get_custom_header_keys_for_ip(); - foreach ( $custom_headers as $header ) { - if ( 'REMOTE_ADDR' === $header ) { - // We want to check every key but REMOTE_ADDR. REMOTE_ATTR is not unique to reverse proxy servers. - continue; - } - - $ip = trim( FrmAppHelper::get_server_value( $header ) ); - // Return true for anything that isn't empty but ignoring values like ::1. - if ( $ip && 0 !== strpos( $ip, '::' ) ) { - return true; - } - } - - return false; - } - /** * @return void */ diff --git a/classes/models/FrmSettings.php b/classes/models/FrmSettings.php index 1362f748ae..77d2c4e311 100644 --- a/classes/models/FrmSettings.php +++ b/classes/models/FrmSettings.php @@ -159,8 +159,7 @@ public function default_options() { 'email_to' => '[admin_email]', 'no_ips' => 0, - // Use false by default. We show a warning when this is unset. Once global settings have been saved, this gets saved. - 'custom_header_ip' => false, + 'custom_header_ip' => 0, 'tracking' => FrmAppHelper::pro_is_installed(), // Only enable this by default for the main site. 'summary_emails' => get_current_blog_id() === get_main_site_id(),