Hi,

First off I must say Thank You for a great module, I use it regularly and it works very well.

In my organization, we have an internal IP address mapping system, and I have a system set in place to map an internal IP to a country via an admin interface.

What woudl be good is if I could inject these rows into your database, so they get considered in the country lookup process. I currently do this by adding a line of code to the ip2country_update_database(); function. Obviously, this is bad.

So, would it be possible to include a a custom hook that gets fired so other modules could insert data into the ip2country table, so that this custom data could get considered when a country is being detected?

I could have a go at writing a patch if you like?

Thanks for your help,

Kev.

Comments

tr’s picture

How about a drupal_alter() call inside ip2country_get_country()? That would allow you to hook into this function and directly query your internal DB as part of the lookup process, rather than having to copy your internal DB into the ip2country DB.

tr’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

I will be implementing this in the 7.x-1.x branch first.

kpbowler’s picture

Great, that sounds perfect! I have not had any experience with drupal_alter(), but after reading the API page for it, that sounds like a much better way to do it. Look forward to the fix!

Thanks again for a great module!

tr’s picture

Should probably add a Rules event for this as well.

tr’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Issue summary: View changes
joshi.rohit100’s picture

Or we can dispatch an event as we are not modifying data, just doing something (I guess).

tr’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

New features go into the 2.0.x branch at this point.