Debug Tool not working

Created on 25 January 2023, almost 2 years ago
Updated 26 January 2023, almost 2 years ago

Problem/Motivation

When I run:

print_r(\Drupal\smart_ip\SmartIp::query($ipAddress));

I get an array of data, but I'm not seeing my debug IP reflected in that data.

Steps to reproduce

Under Smart IP settings, i've checked the boxes for each role. Under Smart IP debug tool, I've added a test EU IP address (103.43.232.0) and togged the user roles for debug mode.

In Manual Lookup, I can enter the test IP (103.43.232.0) and see the fully populated data array with all the correct data for Italy. (I'm using abstract IP).

When I hit the page in the browser, the array is mostly empty, and it shows me my internal router assigned IP.

I'm trying to create a check for GDPR countries.

if (\Drupal\smart_ip\SmartIp::query($ipAddress)['isGdprCountry'] == "") {
      $variables['#attached']['library'][] =  'mylibrary/mycss';
  }
}

The css is loading, but it seems like the field for isGdprCountry is blank, even when looking at the site through a VPN routing through Europe. Trying to debug, but since the debug isn't working for me, I hoped someone could tell me where I was going wrong.

My understanding is that when I've configured the debug tool, I should be seeing the IP I set for that role in that data. Let me know if that's not correct.

Thanks for your help!

πŸ› Bug report
Status

Active

Version

4.2

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States ed2908

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ed2908
  • πŸ‡ΊπŸ‡ΈUnited States ed2908

    The issue seems to have been that I needed to use: \Drupal::service('smart_ip.smart_ip_location')

    to call the array instead of \Drupal\smart_ip\SmartIp::query($ipAddress)

Production build 0.71.5 2024