Call to undefined function get_real_customer_ip
-
Issue Summary:
A recurring error is occurring on the websitemywebSite.comwithin thewc-blacklist-managerplugin. The error logs indicate that the functionget_real_customer_ip()is undefined, resulting in a fatal error in the file/wp-content/plugins/wc-blacklist-manager/inc/backend/actions/form/yobm-wc-blacklist-manager-gravity-forms.phpat line 57. The errors occur multiple times, between2025-07-16 20:58:27and2025-07-16 21:05:01 UTC, which suggests repeated failed attempts by a user or bot interacting with a Gravity Forms submission.Steps to Reproduce:
- Visit the website using a form created with Gravity Forms.
- Trigger a submission of the form (either by a user or possibly a bot).
- The error is logged in the system.
Error Logs:
The log indicates that a fatal error occurs due to the undefined function
get_real_customer_ip()in theyobm-wc-blacklist-manager-gravity-forms.phpfile, specifically at line 57. Issue Analysis:The error arises when the method
WC_Blacklist_Manager_Gravity_Forms->gf_blacklist_validation()is hooked into the Gravity Forms validation process. The functionget_real_customer_ip()appears to be used to retrieve the client’s IP address for blacklist validation but is either missing or incorrectly referenced in the plugin. Possible Causes:- Missing Function Definition: The function
get_real_customer_ip()is not defined within the plugin or any of the included files. - Plugin Incompatibility: The plugin might depend on WooCommerce or another plugin that should define
get_real_customer_ip(), but the dependency may not be installed or activated. - Code Update Issue: A recent update might have removed or renamed the function, causing the current issue.
- Custom Implementation Missing: The function might be expected but wasn’t implemented in the theme or another plugin.
Recommendations for Resolution:
- Check for Plugin Updates:
Ensure thewc-blacklist-managerplugin is up to date. If an update is available, apply it and test the form submission again. - Verify Plugin Dependencies:
Ensure that all required plugins (e.g., WooCommerce, Gravity Forms) are installed and active. Check the plugin documentation for any dependencies. The functionget_real_customer_ip()might be provided by WooCommerce or another related plugin. - Search for the Function Definition:
Use a code editor or SSH to search the WordPress installation forget_real_customer_ip()to ensure that the function exists:grep -r "function get_real_customer_ip" /path/to/website/If found, verify that the file defining it is included correctly inyobm-wc-blacklist-manager-gravity-forms.php. - Temporary Workaround:
If the function is missing, define a fallback version temporarily. Add the following code inyobm-wc-blacklist-manager-gravity-forms.phpbefore line 57:if (!function_exists('get_real_customer_ip')) { function get_real_customer_ip() { $ip = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } return $ip; } }This will temporarily address the issue but may not fully match the plugin’s intended functionality. Ensure testing after implementation. - Disable the Blacklist Validation Temporarily:
If the blacklist feature isn’t critical, you can disable thegf_blacklist_validationhook by commenting it out:// add_filter('gform_validation', [ $this, 'gf_blacklist_validation' ]); - Contact Plugin Support:
Reach out to thewc-blacklist-managerplugin’s support team or check their documentation for known issues withget_real_customer_ip(). Provide the error details and relevant version information.
Additional Notes:
- The frequency of errors (every 10-20 seconds) suggests the issue may be triggered by a bot or automated script. Consider adding CAPTCHA or rate-limiting to reduce these attempts.
- Before making changes, ensure you have backups of the website.
- If you are not comfortable editing code, consider involving a developer or your hosting provider’s support team.
Version 2.0.5
The topic ‘Call to undefined function get_real_customer_ip’ is closed to new replies.