Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 22, 20168 yr 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
December 22, 20168 yr Solution Hello, try { $geoData = \IPS\GeoLocation::getByIp( \IPS\Member::loggedIn()->ip_address ); if ($geoData['country'] == 'DE') { // Show message } } catch ( \Exception $e ) { }
December 22, 20168 yr 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!
December 22, 20168 yr 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.
December 23, 20168 yr 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
December 23, 20168 yr 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
September 23, 20204 yr 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?
September 23, 20204 yr 1 hour ago, sobrenome said: Does the built in GeoLocation method return the latitude and longitude by IP? Yes
September 23, 20204 yr Nice! How can I retrieve it? Tried $geoData['lat'] and $geoData['long'] but there was no data.