Jump to content

Featured Replies

Posted

Hey IPS,

What is the best way to grab the location of a forum visitor? This is what we are trying to come up with. So we have products in the Store on our forum. The only payment method to buy these products are via PayPal. Some of these products have recurring charges, so the package gets renewed every 30 days, 90 days, or 180 days. However, if the individual lives in Germany, they have PayPal restrictions that prevent them from purchasing recurring products. So I want to grab the location of the user, if they are in Germany then I want to display a message on the store index stating the PayPal restrictions and to only buy the non-recurring products. What is the best way to accomplish this task? Looking forward to your advice.

Thanks in advance. 
Aaron

Solved by newbie LAC

Go to solution
  • Solution

Hello,

try
{
	$geoData = \IPS\GeoLocation::getByIp( \IPS\Member::loggedIn()->ip_address );
	
	if ($geoData['country'] == 'DE')
	{
		// Show message
	}
}
catch ( \Exception $e )
{
}

 

  • Author
7 hours ago, newbie LAC said:

Hello,


try
{
	$geoData = \IPS\GeoLocation::getByIp( \IPS\Member::loggedIn()->ip_address );
	
	if ($geoData['country'] == 'DE')
	{
		// Show message
	}
}
catch ( \Exception $e )
{
}

 

This does the trick! Thanks for helping out!

Do note that the IPS Geolocation service works only as long as your license is active. If for whatever reason the license is expired it won't retrieve the geolocation.

  • Author
20 hours ago, teraßyte said:

Do note that the IPS Geolocation service works only as long as your license is active. If for whatever reason the license is expired it won't retrieve the geolocation.

Noted. I will pass this on to my other forum admins. Thanks

  • Author
20 hours ago, teraßyte said:

Do note that the IPS Geolocation service works only as long as your license is active. If for whatever reason the license is expired it won't retrieve the geolocation.

Noted. I will pass this on to my other forum admins. Thanks

  • 3 years later...
On 12/22/2016 at 9:03 AM, newbie LAC said:

Hello,


try
{
	$geoData = \IPS\GeoLocation::getByIp( \IPS\Member::loggedIn()->ip_address );
	
	if ($geoData['country'] == 'DE')
	{
		// Show message
	}
}
catch ( \Exception $e )
{
}

 

Does the built in GeoLocation method return the latitude and longitude by IP?

1 hour ago, sobrenome said:

Does the built in GeoLocation method return the latitude and longitude by IP?

Yes

Nice! How can I retrieve it? Tried $geoData['lat'] and $geoData['long'] but there was no data.

 

Recently Browsing 0

  • No registered users viewing this page.