The recognition of our Geolocation Hook For WHMCS has been continuously growing among the global community of WHMCS users. Having this exhilarating trend in mind, we felt extremely tempted to breathe new life into the original Blog post dated March 2013, and show the current potential lying within this simple, yet undoubtedly powerful tool.

One of the most interesting novelties as compared to the then hook’s advantages is the addition of support for Polish Language Translation For WHMCS. With it, all Polish clients will enjoy a detailed localization of your entire system into their very own mother tongue.

What we present below is the catalog of most essential maneuvers you may carry out thanks to our hook. To help you find your way through the particular features more easily, the article has been supplemented with the exact code lines and clear guidelines on how to adjust them.

  1. Configure the rules of currency, language and template changes
  2. Adjustment of the client area pages depending on your clients location has been simplified to the maximum possible level. Edit the code with the provided in the commented areas tips to achieve any configuration of currency, language and templates.

  3. Select a template depending on a mobile device or a domain used
  4. You may point a template that shall be called, following the device type used, a tablet or a mobile. In the very same way, point the domain names that your visitors are redirected from, to turn on a specific template for them. Uncomment the lines and provide required templates names.

  5. Select adjustable pages of your client area
  6. The hook offers huge flexibility when it comes to personalizing a whole or just a specific part of your client area. You are free to select the exact pages where the alterations should be performed.

  7. Disable the hook with ease
  8. There might be cases when you do not wish the hook to alter the client area. You are given a wide range of possibilities to turn off the hook for specific IP addresses, IP pools or certain user agents – all is up to you!

  9. Get the country with MaxMind GeoIP2
  10. In order to track your clients’ locations, either use the included in the package submodule, or add your own submodule.

If the article does not cover the configuration scheme you look for, it most likely can be found in our Wiki article. Apart from detailed instructions on how to upload and configure the tool, you will find there several visualizations of how the client area may be adapted with this neat, completely free of charge hook.

Get the Hook!

Comments

Shalom Burla
March 12, 2013
Reply

Good one, Thanks ModulesGarden!

Juanzo
March 12, 2013
Reply

Great tip, and it works perfectly well.

Experthost.ro
March 20, 2013
Reply

Everything looks to be fine except the case of forced currency in links (&currency=*). If the customer clicks the button which has such a link it is redirected to cart.php and not to the product or even product group. On second click it works as it should but only after clicking it twice. Testing it several times before adding this comment with 4 browsers.
You have my email address for explicit details.

Piotr Dolega
March 22, 2013
Reply

Hi Experthost.ro,

We have just fixed the problem with (&currency=*). You can download the updated hook directly from this blog article. We are waiting for your feedback.

Gabriel
March 22, 2013
Reply

Hello Piotr
Are you sure that the downloadable archive is updated ? I did compared previous file and last one and there is no difference between them. This time I didn’t made any modifications (default currency/language) and just uploaded it on server and obviously the problem was still there.
I’d like to have it work at 100% as much as you do and this is the reason why I’m bothering.
PS: I use a new and different browser after each test to get ride of session or cookie which remembers data/values. You can message me directly on Tweeter, Skype or email.

Piotr Dolega
March 25, 2013
Reply

Yes Gabiel, the file has been updated. Today we have verified this twice on our end (downloaded the module from the link provided in this blog article) and the problem you described was fixed, as stated before.
Please create a ticket https://www.modulesgarden.com/openticket and we will assist you, as we expect that the problem is caused by your environment and not by the hook file itself.

Daniel
April 7, 2013
Reply

Thanks for your great work guys.
Having a problem. The old versione of the script posted in february was working great, but the new one is simply not making any action.

Is it possible that the problem is related to recent update to WHMCS 5.2.3?

Piotr Dolega
April 9, 2013
Reply

Daniel, we have verified our hook in WHMCS V5.2.3 and we didn’t find any problems. Script is working properly.

We will be able to further assist over our ticketing system and verify your case.
If you are still having problem with the hook please create a ticket here: https://www.modulesgarden.com/openticket

mrl14
April 9, 2013
Reply

I’ve been looking for this type of functionality for quite some time. The modules here are excellent and really extend the power of whmcs.

Liam Closier
April 9, 2013
Reply

This would really help out in my companies expansion plans

Vincent
April 9, 2013
Reply

This looks great, I just have downloaded it and will test it out!

Altomarketing.com
April 10, 2013
Reply

Excelent work, not only development , your tutorial is very clear, and available for all kind of users. Thanks !

CEFHOST
April 11, 2013
Reply

This is a very useful articles and tutorials.
If it can adapt to 4.5.2 WHMCS version?

Piotr Dolega
April 12, 2013
Reply

Hello CEFHOST, hook should work on WHMCS V4.5.2 however we didn’t have the opportunity to test it.

adersh
April 14, 2013
Reply

Good one, Thanks ModulesGarden! Great work

ish
April 14, 2013
Reply

Excelent work modulesgarden

Nicolas
April 15, 2013
Reply

Will this affect SEO in any way?

In case of all default conditions and in case the visitor is a search engine, i think the hook should not add the “?language=eng&systpl=tplname…”.

Piotr Dolega
April 15, 2013
Reply

Nicolas, to be honest, we didn’t focus on making our hook as SEO friendly as most likely it should be. However we will take this into consideration. I am pretty sure that we are not yet finished with performing changes to the hook, so sooner or later an updated version will appear.

TGE
April 15, 2013
Reply

Does thi module working exactly?
I will download and test it…

Piotr Dolega
April 15, 2013
Reply

Yes TGE, hook works properly. Feel free to download and use it!

Vinko
April 15, 2013
Reply

Hello,
this seems to be very helpfull! How complicated would it be to also force payment gateway depending on selected language (or GeoIP country)? I’d like to block PayPal payments for visitors coming from a certain country.

Piotr Dolega
April 15, 2013
Reply

It won’t be that easy Vinko, because it will require direct template modification in the invoice template. Hook script would need to be called separately to assign the variables within your template. If you are interested, please contact our Development Department.

Awmusic12635
April 17, 2013
Reply

Thanks for the helpful guide, I will most certainly be using it.

Davis
April 18, 2013
Reply

I think other web site owners should take this web site as an model – very clean and excellent style and design, in addition to the content. You are an expert in this area and I will definitely try the hook in my WHMCS!

MichaelDance
April 19, 2013
Reply

That looks very interesting and very confusing, I personally have different domains. eg: .eu .co.uk .in and they redirect to my main website with the ?currency=1 and that configures my website’s prices.

Your way is by the country which is better than my way however they can change the currency by the flags on the new layout or by the cart :).

Nice article, might look into it in the future.

seidonet
April 20, 2013
Reply

You may have a version in Spanish. Many of our clients are Spanish-speaking and it would be necessary

Piotr Dolega
April 22, 2013
Reply

Unfortunatelly we don’t have the Spanish version and it won’t be easy for us to create it 🙂

Marcel
April 20, 2013
Reply

Nice module.
I will buy this next week.

Piotr Dolega
April 22, 2013
Reply

It’s free Marcel, simply download it from the link at the bottom of the article.

Gestinfoweb Inc
April 22, 2013
Reply

I think this is one of the most popular hook it is on the market, I’ll get it immediately and I’m sure the support I receive to make the installation will be more expert in customer service on my system management customer. Cheers ModulesGarden!

Konstantin
April 25, 2013
Reply

nice work guys..

all this – for free – LIKE!

Paris
April 26, 2013
Reply

Great article, lot’s of great info.. thank you!

Jennifer
April 26, 2013
Reply

These modules here are great, just what I was looking for. Thank you!!

brinkaria
May 2, 2013
Reply

I discovered your blog website on google and check a couple of of your early posts. Continue to keep up the really good operate. I just additional up your RSS feed to my MSN News Reader. Searching for forward to reading even more from you later on!

ricardo777
May 4, 2013
Reply

Very nice blog, and also nice modules for WHMCS can really use it for production environment.

Abe Sippy
May 18, 2013
Reply

I’ve recently started a business, the info you provide on this site has helped me greatly. Thank you for all of your time & work.

asturmas
May 23, 2013
Reply

Hello,
Your tip is very good and a must have. Should be a default feature of WHMCS.
I will try the hook in my WHMCS soon.

Thanks,

Quintin Krack
July 20, 2013
Reply

Thanks for the interesting blog post, how can I make is so that I get an email when you make a new post?

Piotr Dolega
July 22, 2013
Reply

Simply sign to our RSS feed. You can find the button in the upper-right part of the blog.

Vit
August 30, 2013
Reply

Please can you add installation instuctions for this addon? Im unable to find it in WHMCS when uploaded to /modules/addons as folder or as php file. or into /modules/

Piotr Dolega
August 30, 2013
Reply

Hi Vit,

The first part of the article/tutorial with installation steps can be found on the WHMCS Blog. Link is located on the top of this page. This article is a second part.

Mohsin
October 8, 2013
Reply

It wont perfectly work if end user first time try to goto cart.php?a=add&pid=141
it just redirect to cart.php?language=xxx&systpl=xxx

Piotr Dolega
October 8, 2013
Reply

Thank you for pointing out the problem.
We will take care of this as soon as possible.

Darshan
October 11, 2013
Reply

I am new to whmcs. I have downloaded the files and placed them in the includes/hooks folder as mentioned. However I do not know where and how I should configure the $country variable. Could you please provide a few more steps of instructions.

Piotr Dolega
October 14, 2013
Reply

You can find more information on the first part of the article (link in the top of this page). If that’s insufficient then please create a ticket.

Mahdy
November 1, 2013
Reply

Hi :

Thank you for your great code , it work fine .
I need also any code for auto switch payment gateway base user IP like language and template , is it possible generate this code ?

Thank you

Piotr Dolega
November 5, 2013
Reply

Hi Mahdy,

I am happy to hear that hook is working well for you.
It won’t be a problem for us to create such a code. Please contact us here: modulesgarden.com/order/request

Akash Suresh
November 12, 2013
Reply

I added domainchecker.php to the list of allowed files.But when I do so,I get a blank page when I check for the domain availability

Piotr Dolega
November 13, 2013
Reply

Hi Akash,

In this case please open a support ticket.

Nicolas
January 23, 2014
Reply

Lets says the visitor enters domain.com/cart.php?gid=1

If a language redirect applies, the hooks will redirect him to domain.com/cart.php?language=english

Is there any way to properly redirect the visitor to domain.com/cart.php?gid=1&language=english

Piotr Dolega
January 23, 2014
Reply

Hi,

According to our quick tests you should have been redirected to domain.com/cart.php?gid=1&language=english . I have updated the hook file on our server which should help. Please download it once again and check whether this solved the problem.

Nicolas
January 23, 2014
Reply

Thanks for the prompt reply.

Works great now!

Nicolas
January 24, 2014
Reply

I’m looking for a way to prevent adding the default language to the URL redirection (?language=english) but still updating the currency.

What do you think about this:

if($_language == $country_to_language[‘default’]){
ob_clean();
header(‘location: ‘.$_SERVER[‘REQUEST_URI’]);
die();
}
else {
ob_clean();
header(‘location: ‘.$location);
die();
}

Piotr Dolega
January 24, 2014
Reply

Hi Nicolas,

One of our developers will need to verify this. I will get back to you on Monday.

Piotr Dolega
January 27, 2014
Reply

This will not work as intended. Indeed, language won’t be changed, but neither the template. Do you want to make ‘language’ parameter invisible in URL when customer’s language is the same as default WHMCS language?

Please open a support ticket and provide us with more details.

Juan Manuel Zolezzi
February 7, 2014
Reply

I’d love to see this packaged as an addon, adding for example payment methods per country.

In case anyone else is interested as well, please show your support ModulesGarden forums!

Agung
April 1, 2014
Reply

I’ll second this request. I’d like to have this feature also

Hohny
March 2, 2014
Reply

Waiting to be released for the new 5.3.5 version, because it doesn’t work!
Thanks!

Piotr Dołęga
March 3, 2014
Reply

Could you describe which part of the hook doesn’t work?
We will verify this as soon as possible.

Hohny
March 3, 2014
Reply

As i have seen until now, the allowed scripts page, is not working.
For example:
I will initially try to visit site.com/a.php
The result is a blank page!
But if I visit, site.com and then try to visit /a.php, the script works fine…

Ricardo
March 5, 2014
Reply

Hello,
After updating to version 5.3.5 I am getting a blank page with the message of “Incorrect redirection” (Firefox) / “Redirection Loop” (chrome).

Any idea please?
Thank you

Piotr Dołęga
March 5, 2014
Reply

We are on it Ricardo. Our developer is currently investigating all the problems with the hook and WHMCS 5.3.5.
I will attach an updated version with fixes as soon as possible.

agung
April 5, 2014
Reply

Hi,
any update on whmcs 5.3.6?

Piotr Dołęga
April 7, 2014
Reply

We have just updated the hook to work properly with version 5.3.5. Sorry guys that it took so long. We haven’t tested it on 5.3.6 yet but we don’t expect any troubles with this version.

RUben
April 9, 2014
Reply

Hello,

Awesome! I can’t wait to test it on my WHMCS.

Thanks

brian
May 29, 2014
Reply

Hi,
any update on whmcs 5.3.7?

installed not work

Piotr Dołęga
May 29, 2014
Reply

Hi,
Could you be more specific please? What exactly does not work?
We will verify this as soon as possible and release an update if necessary.

brian
May 29, 2014
Reply

language and currency does not work,
I did not do any configuration, I just uploaded the file geolocation_hook.php, geoip.inc and GeoIP.dat.
always display default language and currency, try change my ip , but not work
Another configuration?
thank you

brian
May 29, 2014
Reply

language and currency does not work,
I did not do any configuration, I just uploaded the file geolocation_hook.php, geoip.inc and GeoIP.dat.
Another configuration?
thank you

Piotr Dołęga
May 29, 2014
Reply

We will check this out Brian. Thank you the information.

Brian
May 29, 2014
Reply

additional
when first open, after upload 3 files
and I access client.mydomain.com
just display geoip.inc
not display index page ,
after refresh, display client.mydomain.com /? systpl = default
I really need this hook

Thank you Piotr

Piotr Dołęga
May 30, 2014
Reply

Brain,

We have verified this on WHMCS 5.3.7 but we are unable to find a malfunction in our hook. We expect that the problem lays within your configuration but we are not sure about that. Could you please create a ticket and provide us with access details to your system? In this way our developer will help you solve the problem.

Adrian
July 14, 2014
Reply

Hello, that it is necessary to prescribe in order depending on user IP automatically put the country (ex. RU-Russia, DE-Germany and etc.).

Piotr Dołęga
July 14, 2014
Reply

Hello Adrian,

I am afraid that we do not understand your point. Could you be more specific and provide us with a detailed example?

Arnold
August 17, 2014
Reply

Hello, how to configure auto-detection of the country, depending on the IP?

Piotr Dołęga
August 18, 2014
Reply

Hello Arnold, that is an inbuilt functionality of the hook. There is no need to configure it as it works immediately after the set up.

Jose Dieguez
September 15, 2014
Reply

Where can i find the Donate Button?, this totally works for my site :), i will make some adjusts to the custom template, and everything should be perfect.

Piotr Dołęga
September 15, 2014
Reply

We are delighted to hear that Jose! Your feedback is the greatest reward for us, there is no need to donate 😉
Feel free to share your opinion on our Forums or any other place.

Ernesto
January 14, 2015
Reply

Hello,

Is there a way to call this hook to the non whmcs pages? I added price feeds on it and it would be great if they could change depending the country visitor.

Thanks!

Ernesto

Piotr Dołęga
January 16, 2015
Reply

Hello Ernesto,

Are those non whmcs pages anyhow connected or have anything to do with WHMCS? Or are they completely separate and independent from WHMCS in all aspects?

Ernesto
January 20, 2015
Reply

They are completely separated from WHMCS and independent. They are php but not smarty.

Piotr Dołęga
January 22, 2015

Ernesto, in this case we would need to access your environment and check it out because basing on last statement, it is difficult to guess whether we can call the hook or not. Feel free to create a ticket and one of our developers will check this for you.

ivan
May 19, 2015
Reply

If you go as new visitor, with no session nor cookies on a custom page the module is not working.
Custom pages send the headers differently from default whmcs pages.
How to solve that?

Joanna Zając
May 20, 2015
Reply

Please make sure that the array $allowed_scripts contains php file name that is associated with the custom page.

If this does not resolve your problem, please open a ticket. Our Support Team will find the cause and eliminate it in the shortest time possible.

Don
June 6, 2015
Reply

I have the plugin working, but I noticed that it’s no longer possible to change currency by clicking on the flag/currency tab after it’s been set. So it does work, but changing currency is no longer an option after it gets assigned to the client. Is there a way to allow users to still change their currency?

Don
June 6, 2015
Reply

Actually, I think I’ll just remove the option to choose currency, and have the hook take care of it. So the plugin is working as expected. Nice work.

Don
June 9, 2015
Reply

Where I think this module would be great would be to integrate with MultiBrands and ResellerCenter. Think of it from EU VAT where you may want different Brand or Reseller for specific region/partners. Just my 2 cents.

Chris
October 5, 2015
Reply

Hi

how long until this is updated to work with WHMCS v6?

Piotr Dołęga
October 7, 2015
Reply

Hi Chris!

Actually, today! Within an hour or two.

Chris
October 12, 2015
Reply

HI

I’ve replaced the old code with the new code and it still doesn’t work for me 🙁

Chris
October 12, 2015
Reply

ahh scrap that! it does work 🙂

Aivaras
October 21, 2015
Reply

I have uploaded and added country LT and language lithuanian, but Im always getting error:
PHP Fatal error: Cannot redeclare geoip_country_code_by_name() in includes/hooks/geoip.inc on line 438

Please help!:)

Joanna Zając
October 22, 2015
Reply

Hello Aivaras,

Your problem stems most probably from the fact that you attempt to overwrite the existing country. LT is already included in ‘geoip.inc’ file and that may cause conflict in the hook.

Aivaras
October 22, 2015
Reply

I have added ‘LT to the file geolocation_hook, but not to the ‘geoip.inc’.
Just simple as in instructions:
$country_to_currency = array(
‘default’ => ‘USD’,
‘LT’ => ‘EUR’,

and geting error: PHP Fatal error: Cannot redeclare geoip_country_code_by_name() in includes/hooks/geoip.inc on line 438

Joanna Zając
October 23, 2015
Reply

In this case, please open a ticket and include access details to your WHMCS admin area and FTP server so our Support Team can help you find the cause of your problem and eliminate it.

Remember that you can use Secured Messages box to encrypt any fragile data.

Wizhosting
October 28, 2015
Reply

Hello, it work fine for me, in my whmcs 6.1.1, but now my visitors can’t manually change the currency in cart.php

Joanna Zając
October 29, 2015
Reply

Please note that there is a following section at the end of a hook’s file:

/**
* Preventing from switching currency by user
* NOTE: You can remove/disable this part if not needed.
*/
if(isset($_SESSION[‘switched_currency’]) && $_SESSION[‘switched_currency’] != $_SESSION[‘currency’] ) {
$_SESSION[‘currency’] = $_SESSION[‘switched_currency’];
}

If you remove it your clients will be able to change the currency.

Hostingperuweb
November 9, 2015
Reply

Thanks and let it installed on my site :).

Amit
November 20, 2015
Reply

Hi, i like your plugin,

but each time i use it show me 500 error and all site down…

i really appreciate if you can help me out, thxx

-Amit

Joanna Zając
November 20, 2015
Reply

Hello Amit,

Please contact our Support Team in that matter as we are not able to help you without the access to your environment.

karthik
February 3, 2016
Reply

this script works well in cart.php, but not working in index.php. Index.php is added in $allowed_scripts array. Hook works in index.php, but i dont know how to get the currency id.

Joanna Zając
February 4, 2016
Reply

Kindly note that there is no need to search for currency id because there is a built-in function in the hook which carries out this task automatically.

Should you require any further assistance in that matter, please contact our Support Team.

Aivaras
February 16, 2016
Reply

After uploading script, Im Always get the same error:
Fatal error: Cannot redeclare geoip_country_code_by_name() in includes/hooks/geoip.inc on line 438

My country is LT
Please help, I can’t find the solution more than 6 months

Joanna Zając
February 16, 2016
Reply

Hi Aivaras,

It will be best if you open a ticket in that matter as we suggested in the response to your previous comment. Once you provide required access details, we will be able to eliminate the issue directly in your environment.

cagri
February 29, 2016
Reply

?language=english&systpl blabla

This script must cause Bad rep for SEO, I try to add rewrite url rules Web.config/htaccess or geo locatin php for other method but i couldn’t get any sollution.

If when user get indexphp?language=english&systpl blabla is rewrite for ex: index.php/en or default domain.com, This script Would be %100 Perfect for using

Anyone have got idea for solve this problem?

Thank You

Joanna Zając
March 4, 2016
Reply

Thank you for pointing this out. It will be fixed in the coming version that should be available for download within a few days.

Ezequiel
December 12, 2018
Reply

“Thank you for pointing this out. It will be fixed in the coming version that should be available for download within a few days.”

was implemented this feature?
how can be use?

Joanna Byjoś
December 13, 2018

Yes, the problem related to SEO was successfully disposed of back in April 2016. To take advantage of the latest release of Geolocation Hook For WHMCS, simply download it from our website. Also, if you wish to keep tabs on the flow of its updates, be sure to have a careful look at the changelog.

Esteban Cervi
March 18, 2016
Reply

It works really well!

Cagri
April 1, 2016
Reply

excited anticipation continues for new version 🙂 If SEO problem will be solved

thank you

June
April 2, 2016
Reply

Please update with the problem described by Cagri. It really hurts the SEO and even it doesn’t looks professional. I am also waiting for the update. Hope to get it soon.

Joanna Zając
April 5, 2016
Reply

Hi guys!

We are pleased to inform that the update is ready for your use!

The new version covers the ability to define the HTTP response code for site redirection and, of course, the fix to the reported SEO issue. Thank you for your patience!

Aivaras
April 6, 2016
Reply

Finally, now it works great!

tweakservers
April 14, 2016
Reply

On the 7.1 which is to remove the currency change from the template, apparently this does not appear out as lines of codes under the WHMCS v6 standard_cart. While the hook is added on 7.2 to prevent the changes, it might be good to just take this off from the client area cart as trying to click to change the currency does not looks to be working due to the use of this geolocation hooks.

tweakservers
April 14, 2016
Reply

Okay got it.. apparently the modern template was being reference as well from the standard_cart, removing the currency in the modern cart products.tpl did the trick. However, we do notice there’s 2 section of the code needs to be remove – one as outlined on the guides above and the other one just at the end of the same files.

Joanna Zając
April 15, 2016
Reply

Would you be so kind as to contact our Support Team directly and elaborate a bit more on what you think should be changed? Thank you!

Jota
April 20, 2016
Reply

Where do we setup $country variable ? in geoip.inc file ?

Thanks !

Joanna Zając
April 21, 2016
Reply

There is no $country variable in the hook, a country is determined basing on client’s IP.
IP addresses database (IP pool per country) is located in GeoIP.dat file.

Cagri
April 29, 2016
Reply

Hi again 🙂 Your last update had cause little bit something wrong js. When our customers get on Mobile, we just forward ?systpl=mobile with javascript on header, Now your systpl is not working this hook, Already we are tryin on

$useragent=$_SERVER[‘HTTP_USER_AGENT’];
if(preg_match(‘/(android|bb\d+|meego).+mobile|avant….. blabla ?? …..

{ $language_to_template = array(
‘english’ => ‘mobile’,
‘turkish’ => ‘mobile’,
‘default’ => ‘mobile’

// NOTE: You can add more below
);

} else
{$language_to_template = array(
‘english’ => ‘desktop’,
‘turkish’ => ‘desktop’,
‘default’ => ‘desktop’

// NOTE: You can add more below
);}

Gotta any ideas?

Best Regards.

Joanna Zając
May 4, 2016
Reply

Hi Cagri!

Can you please join us in a ticket? It would be the best and fastest way to take a deep look at the issues.

Aivaras
May 10, 2016
Reply

Sorry, but this version still have a bug.
1. $responseCode = 302; – killing seo completely, and search robots goes away because site moved permanently to nowhere..

2. If part |$language_to_template” removed, SEO works good, but country to language redirection stops working.

Joanna Zając
May 12, 2016
Reply

Kindly note that you can insert either 301 or 302 code to choose a desired website redirection type (permanent or temporary).

Aivaras
May 10, 2016
Reply

How to safe remove all parts about template redirecting, to get script still working for country and currency redirection and still accessible for search robots.

Joanna Zając
May 12, 2016
Reply

To successfully prevent template redirection please do as follows:
1) Remove code snippet: "&& !empty($systpl)", you should find it in line 167.
2) Comment out code snippets in lines 172, 174 and 191-233.

Steve Kemp
June 24, 2016
Reply

I have installed this hook however its throwing an error on the admin of whmcs

Fatal error: Call to undefined function geoip_open() in /home/XXXXXX/public_html/includes/hooks/geolocation_hook.php on line 123

how do i correct this error?

Piotr Dołęga
June 24, 2016
Reply

Hi Steve,

It appears that you have not uploaded the files correctly. Please refer to section above: 5. Uploading GeoIP.dat And Library To The System.

Yasin
July 4, 2016
Reply

Hello

The geoip.dat file is started to became older and not recognizing the new ips. Are you thinking to refresh the module for the new built GeoIP2 ip database of MaxMind ?

Piotr Dołęga
July 5, 2016
Reply

Hello Yasin,
We will put this idea on our roadmap.

Yasin
July 11, 2016
Reply

Hi Again,

How can i set a currency if the IP is not recognised by the geoip ? For example it some times not recognizing ip addresses and changes the currency of the order to my local currency. However the problem is, if the product is priced as 5 usd it creates an invoice as 5 euro . I think the problem is about defining the ip and the country ip belongs to.

My aim is, where ever a visitor comes, if the ip is not recognized , force him to set currency predefined.

Hope you can help.

Piotr Dołęga
July 12, 2016
Reply

Yasin,

The functionality you described is already available in Geolocation Hook For WHMCS. Please search for $country_to_currency array and modify it according to your needs.

ISPAZE
September 21, 2016
Reply

Excellent Module , very useful

Thank you

Hosting Web Peru
October 1, 2016
Reply

Excelente blog, con buenas ideas y contenido me gustaría recomendarte una empresa donde podras conseguir y donde te podrán ayudar a tener un sitio web propio.

Saludos

Alex
October 25, 2016
Reply

Hi there,

with php7 and whmcs 7.0.1 i have the problem, that we get the blank page, if customer come to site. The same like amit at 20 November 2015 here uper case. If we reload the page, all is very well. What can we do?

Thanks

Stathis
October 25, 2016
Reply

Hey! Script is in a redirect loop for whmcs 7 and php 7.

Can you check and provide an update?

Joanna Zając
October 31, 2016
Reply

Hello Alex and Stathis!

All your troubles most probably stem from the fact that the hook has not been yet adjusted to support WHMCS V7 and PHP 7. We are currently working on it, please expect the update to be available next week!

Alex
November 1, 2016
Reply

Hello Joanna Zając,

thanks for infromation, so we wait 🙂

Joanna Zając
November 9, 2016

Please be aware that the update of Geolocation Hook For WHMCS might be available a bit later than initially anticipated. I will certainly keep you informed on the progress in that matter.

I also encourage you to visit our social media profiles – we post there instant announcements on each relevant release.

Hashmi
November 10, 2016
Reply

Hi,

Thank you for this great help.

However, when I do all this, nothing is changed. No error, it simply does not change any thing. Do I need to have any other module with this too or it is not working because you are going to update the script?

Thanks

Joanna Zając
November 10, 2016
Reply

You do not need any additional pieces of software to make the hook work, Hashmi. If you use WHMCS V7 please wait for the coming release as your issues are most likely related to the current lack of compatibility with V7.

Hashmi
November 10, 2016
Reply

Thank you so very much. I will be waiting eagerly for that. Was curious just because I saw people mentioned redirection errors/blank pages on v7 but mine just didnt do any thing.

Smith
December 19, 2016
Reply

Automatic Currency And Language hook not working on my site i am using WHMCS Bridge Version 3.8.3 . I try this hook on my site but this hook not working means it not changed currency based on geolocation i want if customer open this site in UAE then selected currency should be in AED and if customer open my site in other country then selected currency will be in $. please tell me the solution

Joanna Zając
December 27, 2016
Reply

It is difficult to identify the root cause of your troubles without looking into your system directly. Please join us in a ticket – use Confidential Data field to provide all access details in a highly secure manner.

Montri
December 28, 2016
Reply

Hi,

I would like to have the hook for the V.7, How I can do it? Seem now the link for download is death.

Kindly advise.

Joanna Zając
December 30, 2016
Reply

Hi Montri,

Kindly check it once again, the link should work properly.

Please be advised, however, that the hook has not been yet adjusted to support WHMCS V7. Its new version is due in the next couple of weeks.

Piotr Dołęga
February 8, 2017
Reply

We are happy to announce that the next generation of our
Geolocation Hook For WHMCS
with WHMCS V7 & MaxMind GeoIP2 support and fully rewritten code has been released (v2.0.0). We have also created a documentation available on our Wiki. Enjoy!

GoVPShost
February 9, 2017
Reply

I want to get current currency value in homepage.tpl, how would i get currency value in homepage.tpl

Joanna Zając
February 15, 2017
Reply

There is no possibility to display a currency in a home page, unfortunately.

Johnny
February 13, 2017
Reply

Thank you for creating it a newer version! It doesn’t seem to work on my end though, and I have a question.
I want to use only “country to language”! Is it possible to change the language on the first visit without adding “?language=…”?

Joanna Zając
February 17, 2017
Reply

If I understand your question correctly, setting up a desired language as a default one should do the job. This is the section you need to adjust:
$countryToLanguage = array(
'default' => 'english',
'US' => 'english',
'DE' => 'german',
'NO' => 'norwegian'
// NOTE: You can add more below
);

If the above mentioned suggestion does not resolve your doubts, I would like to kindly ask you to provide us with more detailed explanation via ticket.

Cullen Carstens
April 17, 2017
Reply

Please look at making a video tutorial for dummies…

Joanna Zając
April 21, 2017
Reply

We are eager to provide customers with precise information on our products so we will surely consider creating a video presentation of Geolocation Hook For WHMCS. For now, you are more than welcome to explore our Wiki documentation that will guide you through the operation of the hook step by step!

Kazi S.
May 22, 2017
Reply

When it’s in active state WHMCS started showing warning “A Certificate Authority verified SSL certificate was not detected on domainname. This will prevent some features, such as OpenID Connect, from functioning. This may also affect your ability to receive PCI or other accreditation.”

If I disable the hook then warning disappear and OpenID used to function properly.

What’s the way how I can use OpenID and your geo hook together?

Joanna Zając
May 29, 2017
Reply

It might be difficult to find the exact reason behind such irregularity without accessing your environment. The best you can do is reach out to our support specialists directly and let them check the issue right within your system. No worries, all sensitive data are perfectly safe when passed through the Confidential Data box available on the ticket’s submitting page.

Montri
July 26, 2017
Reply

I found the error [WHMCS Application] ERROR: exception ‘Whoops\\Exception\\ErrorException’ with message ‘Class ‘ModulesGarden\\Geolocation\\Geolocation’ not found’ in … on whmcs 7.2

It’s working before update, kindly check out please.

Montri
July 26, 2017
Reply

Another line error
PHP Fatal error: Class ‘ModulesGarden\\Geolocation\\Geolocation’ not found in /public_html/includes/hooks/geolocation_hook.php on line 24

Joanna Zając
July 27, 2017
Reply

Many thanks for bringing these issues to our attention, Montri! They have been already forwarded to the relevant department for further examination.

Montri
July 29, 2017
Reply

Kindly let me know the update for this issue, if you need any more details, feel free to contact me as email provided.

Thanks.

Joanna Zając
July 31, 2017

Reaching our experts at Support Team directly through a ticket is the easiest way to be kept closely informed on the progress in this case, Montri. We warmly invite you to do so.

Johny
December 24, 2017
Reply

There is a problem with facebook share. When you are trying to share a link on facebook, it doesn’t parse anything simply because it uses the redirection method.
I have tried debugging the link in facebook debugger, but the problem is still there.

Anybody found a work around on this?

Dominika Kusy
January 22, 2018
Reply

Please note however, that our module makes redirections by default and in principle this part should not be tampered with. If you require further assistance on how to work around this issue, just contact our Support Team and they will do their best to come up with a solution.

Adaberemchi Aja-Onu
January 20, 2018
Reply

Hello,
After following the instructions in your blog we find that the currencies for other countries setup switches for USA, Germany and United Kingdom but does not work for Nigeria. Could you please help?

Dominika Kusy
January 22, 2018
Reply

Can you please make sure that you have configured all the relations in the ‘includes/Geolocation/config.php’ file correctly? This is the exact section you need to adjust:

$countryToCurrency = array(
'default' => 'USD',
'US' => 'USD',
'GB' => 'GBP',
// NOTE: You can add more below
);

It should contain the country code specific to Nigeria which is ‘NG’. Should you encounter any more difficulties, contact us via a ticket for further instructions.

salah
March 16, 2018
Reply

all the explanation you provide for this is only about the hook file i also see other folder in the zip i downloaded but there is no explanation where i can place it i also follow the explanation above and the result that my website stop working completely and the code i copy and past just same as you give above and it give me error and it become red color . so is there easy way to make this more easy for us ? i am just wandering for something why you just not make this ready for people to upload you can just place the code that you write pages about it in the files of the program and make it more easy for people to just upload in the folder than it will work . i feel like i need to study coding so i can use this lol its like you are giving us coding lesson not only program for use . anyway is there way for me to use this ? i want only to change language for countries so . i do not know what to do and as i said i copy the code you give above and it make my website stop working completely . code error . thanks

Dominika Kusy
March 19, 2018
Reply

Hi Salah! Feel invited to study the Geolocation Hook For WHMCS documentation which will get you through the whole process step by step. We are positive it will provide you with all the answers you are looking for. If not, do not hesitate to contact our Support Team for more detailed explanation.

Lucian
June 25, 2018
Reply

When i want to buy a product (cart.php?a=add&pid=1) is redirecting to cart.php. Why?

Joanna Byjoś
June 28, 2018
Reply

Hi Lucian,

There are at least several possible causes behind this sort of an error, and without a deeper insight it is rather difficult to identify the right one. Please join our support specialists in a ticket so they can have a closer look at the issue.

Ramiz Syed
October 22, 2018
Reply

Hi,
I was using it on WHMCS 7.1.2, it was working perfectly, after update WHMCS 7.6 it’s not working.
I prefer it for IP based currency switch.
have you test it on latest WHMCS 7.6 version?

Thank you

Joanna Byjoś
October 22, 2018
Reply

Hi Ramiz,
We have not detected any faults in Geolocation Hook For WHMCS during the internal WHMCS V7.6 compatibility check. Please discuss this further with our experts at the Support Team, they will help you remove all problems affecting the hook’s operation.

Simon
April 14, 2019
Reply

Hello,
Thanks for your great product.
Is it possible to translate the Company name (WHMCS Website name)?
And also translate the contents of template like footer text and etc…

Dominika Kusy
April 15, 2019
Reply

Hi Simon,

Geolocation Hook For WHMCS enables you to set up the automatic switch of only such elements as currency, language, and WHMCS client area template.

You may freely discuss any other issues that might be troubling you with our Support Team directly.

EstrategiasWeb
June 1, 2019
Reply

Great! this helps a lot when you had sites for multiple countries.

Joachim
June 3, 2019
Reply

Hello

I am trying to get this to work with a template I bought “control”, but it does not load that template, even if it is set to default.

What can be wrong?

Dominika Kusy
June 3, 2019
Reply

Hello Joachim, we are unfortunately unable to specify the exact reason for this occurrence without some extra information. If you could join us in a ticket, we will gladly look into your issue in a closer detail and help you dispel the doubts.

Mic
June 18, 2019
Reply

Will I still to:
1. Add the new currencies in the Currency page in the Admin?
2. Click on Update Product Prices in the Currency page in the Admin?

Will the currencies still lined up in the Order form or it will not but rather clients will automatically have the assigned currency?

Dominika Kusy
June 24, 2019
Reply

Please mind that the module is aimed to automatically switch only the already defined currency, language or template of your WHMCS client area. Therefore, you will still need to visit your admin area in order to add new currencies and update product prices. In case of further questions, please reach out to our folks at the Support Department.

Santosh Ramachandran
August 8, 2019
Reply

Hi, Thanks for this plugin.

We have 2 currencies usd (default) & inr

We have setup the config as INR for india and usd for the rest of the world & the default currency

Now when we sign-up from india, initally the currency is switched to INR, now if the user creates the order goes to the payment gateway, and returns without a successful payment, now the currency in india is displayed in USD

i.e. when the user has been logged in the hook is not working, can we apply the hook to logged-in users too, can we do that?

If we logout the currency shows in INR correctly

Our whmcs url infinityonlinesolutions.com/infyadmin

Dominika Kusy
August 9, 2019
Reply

We would like to take a closer look at this case and advise you on the best possible solution. Will you please join us in a ticket? Looking forward to hearing from you!

Santosh Ramachandran
August 10, 2019
Reply

Hello Dominika, Thank you for your help, created ticket No 786037

Thanks and Best Regards.

Dominika Kusy
August 13, 2019

The pleasure is all ours, Santosh!

Kamil
September 6, 2019
Reply

Module is not working with current WHMCS 7.8.2. It is getting error with including GeoIP2/geoip2.phar/phar-stub.php

Dominika Kusy
September 6, 2019
Reply

While we are actively working on ensuring the full compatibility between our modules and the newest WHMCS 7.8 version, Geolocation Hook For WHMCS is yet to go through the required testing procedures. Please find the full list of already confirmed modules on our official Forums. As soon as we have integrated the hook as well, it will be added to the record immediately.

abogoud
September 18, 2019
Reply

Thanks for your great work guys.

i am Already Whmcs Version 7.x Requirement php Version Minimum 7.1
now issue file geolocation hook.php Requirement php Version 5.6.x

Kamila
September 19, 2019
Reply

Thank you for reaching out! Our Support Team has already received your inquiry – we will investigate the matter in the shortest time possible and then get back to you with more details.

Praveen
November 4, 2019
Reply

I am getting the following error

Whoops\Exception\ErrorException: require(): Failed opening required ‘phar:

Can someone help me with it?

Kamila
November 4, 2019
Reply

Hello Praveen, we are unfortunately unable to specify the exact reason for this occurrence without some extra information. If you could join us in a ticket, we will gladly look into your issue in a closer detail and help you dispel the doubts.

yogesh
October 17, 2020
Reply

Hi, my first landing page in card shows that the hook is working but on all other pages dollar is selected and i just don’t get removed no matter what i try, can anyone help ?

Joanna Byjoś
October 27, 2020
Reply

Hi Yogesh! We have not encountered any such issues, could you please make sure the instructions provided in our Wiki documentation have been followed step by step?

Jesus Suarez
February 4, 2021
Reply

thanks

after checking your module for version 8.1.0 I see that it doesn’t work.

throws multiple errors.

it works fine in whmcs v8.0.4, but in 8.1.0 it doesn’t.

If you are kind enough to support the hook I would be grateful.

Joanna Byjoś
February 4, 2021
Reply

No worries! Our Geolocation Hook For WHMCS is already in the middle of detailed examinations towards its WHMCS V8.1 compatibility. As soon as the update has been released, you will see the hook included in the official WHMCS 8.1 support list, so be sure to keep a regular check on it.

Eugene van der Merwe
February 16, 2021
Reply

To add to @jesus suarez’s comment about the GeoLocation incompatibility, if you upgrade to 8.11 you get this in the Client Area (Admin area still works):

Error: Call to undefined method WHMCS\View\Template::getTemplateConfigValues()

I couldn’t find anything on Google so submitted a ticket to WHMCS. On the first reply they just told me to re-install, but because my system was down for two days already I completely deleted all files and had to set everything up from scratch.

Joanna Byjoś
March 1, 2021
Reply

Thanks for sharing an additional input, Eugene! This and all other problems related to WHMCS V8.1 incompatibility will be disposed of as soon as we release the new version of Geolocation Hook For WHMCS, yet this month.

Omar
April 3, 2021
Reply

Hi,

Joanna Byjoś earlier in March you were telling Eugene that this Hook would be ready for whmcs 8.1 compatibility during that month, apparently it has been extended a bit more. Any announcement on when 8.1.3 compatibility will be ready? Thanks

Joanna Byjoś
April 6, 2021
Reply

Hi Omar! We still have quite a few complex modules on the examination table, hence this unfortunate delay in works on a new version of Geolocation Hook For WHMCS. This should take just another couple of weeks tops, thanks a bunch for your patience so far!

Frazer
April 22, 2021
Reply

Hi Guys,

Hope you’re well.

Tried the module today, but it didn’t work.
Looks like it’s still not compatible with whmcs 8.1

Hoping you will release an update ASAP 🙂

Joanna Byjoś
April 26, 2021
Reply

Hi Frazer, I come bearing great news! There is a strong chance that Geolocation Hook For WHMCS will receive the awaited WHMCS V8.1 support yet this week, so keep your eyes peeled! 🙂

Cee
April 23, 2021
Reply

I have added the currency and country, do I have to change the IP address too please? and how?

Joanna Byjoś
April 26, 2021
Reply

Hello Cee, we are unfortunately unable to assist without a bit more insight. If you could share some more details via ticket, our support agents will gladly offer you careful guidance on the next configuration steps.

Joanna Byjoś
May 17, 2021
Reply

 
We are thrilled to bits to finally confirm that our Geolocation Hook For WHMCS is now in full compatibility with WHMCS V8.1!
 
Go ahead and log in to our client area to gain access to this
brand-new and totally free update.
 

VNIT
May 18, 2021
Reply

when module error The address x.x.x.x is not in the database. module not return default currency in setting

Joanna Byjoś
May 19, 2021
Reply

May I please ask you to report this issue straight to our support teams? This way, it will be properly looked into and comprehensively addressed.

Someone's Son
August 8, 2021
Reply

Does this module work if you are using Cloudflare?

Joanna Byjoś
August 9, 2021
Reply

Yes, our Geolocation Hook For WHMCS can be used with Cloudflare, but you need to set up your server appropriately. You can learn more about that specific configuration here.

Hari
August 30, 2021
Reply

Hi, When will it be compatible with the latest version 8.2.1? Will this work with 8.2.1, I don’t want to break my site.

Joanna Byjoś
August 31, 2021
Reply

Hello, Hari! The hook has already been confirmed to work well in the environment of WHMCS V8.2.1, so you can safely go ahead!

Taha IRAK
November 4, 2021
Reply

Hello, thanks for this great module!
How can update ip database? I think this file: GeoLite2-Country.mmdb
And i find this: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data?lang=en

Is it true?

Thanks again.

Joanna Byjoś
November 5, 2021
Reply

Hi! It’s so great that our hook fits your needs well, Taha.

And to answer your question: all you need to do is download the mentioned file and overwrite the one that is currently in our module. Hope that helps!

Otavio Marchioli
July 28, 2022
Reply

Hi, i’m having a bug with this hook where in the first page load (incognito) the language is correctly set but if I have lang overrides files, the overrides are not loaded, and I end up with a page half translated. If I reload, since the language is already set in the session, the page is loaded correctly.

Otavio Marchioli
July 29, 2022
Reply

To solve this I had to edit the lib code, do you guys have a public repo where I could send a PR with this change?

Maksymilian Kulig
July 29, 2022

Hello Otavio, thanks for your feedback! Unfortunately we don’t have a public repo, but you are more than welcome to get in touch with our team and share details via a ticket.

Timur
November 23, 2024
Reply

Hello, can you Share your solution please? I have same problem

Joanna Byjoś
November 25, 2024

Hi Timur! Please join us in a ticket, and we’ll personally walk you through the fix step by step.

Anna Bystrzanowska
January 26, 2024
Reply

 
Time for a much-anticipated piece of news: our Geolocation Hook For WHMCS is now in full sync with WHMCS V8.8 and WHMCS V8.9, and features support for PHP 8.1 version!
 
Don’t miss out on this major update and enjoy free access to this useful tool!
 

Piotr Dołęga
March 5, 2026
Reply

After 13 years, the time has come to say goodbye to the Geolocation Hook For WHMCS.

Thank you to everyone who used it, supported it, and showed interest in this small but helpful tool over the years. It has been a part of our journey for a long time, and we truly appreciate the community around it.

Every project has its time, and today we officially retire it from our offer. Something ends so that something new can begin.

In many ways, its legacy continues through our Lagom Smart Order Form For WHMCS module, which brings modern automation and geolocation features to enhance the shopping experience.

We warmly invite you to give it a try!

Write a Reply
Comment
Name
Email Address