• Resolved Marcus

    (@power2009)


    Issue Summary:
    A recurring error is occurring on the website mywebSite.com within the wc-blacklist-manager plugin. The error logs indicate that the function get_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.php at line 57. The errors occur multiple times, between 2025-07-16 20:58:27 and 2025-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:

    1. Visit the website using a form created with Gravity Forms.
    2. Trigger a submission of the form (either by a user or possibly a bot).
    3. 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 the yobm-wc-blacklist-manager-gravity-forms.php file, 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 function get_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:

    1. Check for Plugin Updates:
      Ensure the wc-blacklist-manager plugin is up to date. If an update is available, apply it and test the form submission again.
    2. 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 function get_real_customer_ip() might be provided by WooCommerce or another related plugin.
    3. Search for the Function Definition:
      Use a code editor or SSH to search the WordPress installation for get_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 in yobm-wc-blacklist-manager-gravity-forms.php.
    4. Temporary Workaround:
      If the function is missing, define a fallback version temporarily. Add the following code in yobm-wc-blacklist-manager-gravity-forms.php before 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.
    5. Disable the Blacklist Validation Temporarily:
      If the blacklist feature isn’t critical, you can disable the gf_blacklist_validation hook by commenting it out: // add_filter('gform_validation', [ $this, 'gf_blacklist_validation' ]);
    6. Contact Plugin Support:
      Reach out to the wc-blacklist-manager plugin’s support team or check their documentation for known issues with get_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

Viewing 1 replies (of 1 total)
  • Plugin Contributor B.Ng

    (@baonguyen0310)

    Thank you for reporting.

    We will release a fix within the next version.

Viewing 1 replies (of 1 total)

The topic ‘Call to undefined function get_real_customer_ip’ is closed to new replies.