Jump to content

Smarty snippet / addon (or similar) to display Geo Targeted Content for State

Recommended Posts

May you please point me into the right direction on how I could achieve this? This is what I imagine would just magically work if I typed into a .tpl file...

{if statecode = "AK"}
hi people from Alaska
{elseif statecode = "CO"}
hi people from Colorado
hi everyone else...

Right now I'm still doing research, here are some notes I have:

* https://www.docs.modulesgarden.com/Geolocation_Hook_For_WHMCS
* site:whmcs.community conditional logic geo localization
* maxmind Geolocation whmcs -fraud
* https://dev.maxmind.com/geoip/geoip2/geolite2/
* https://ipinfo.io/
* https://whmcs.community/topic/249129-custom-html-panel-for-specific-country/
* http://www.smarty.net/docs/en/language.function.if.tpl
* https://www.smarty.net/docs/en/plugins

Any wisdom you may have that can help me achieve what I desire would be awesome. Thanks!


Edited by cdeese8
updated title

Share this post

Link to post
Share on other sites
16 hours ago, cdeese8 said:

May you please point me into the right direction on how I could achieve this?

you missed out one vital piece of information - do you want to do this for everyone or just for logged in clients ?

if logged in clients, then it's simple as "state" will be one of the values in the $clientsdetails array and all clientarea pages will have access to that.

if everyone, then you're in the realms of utilising a third-party Geo-IP location service (e.g one of the ones that you've listed that includes city/states)... although bear in mind that no such service is 100% accurate, and certainly not if the visitor is using a VPN to view the site.

Share this post

Link to post
Share on other sites

This addon might be overkill, but perhaps the Geolocation Hook For WHMCS config.php (geolocation_hook_2.0.1_whmcs\includes\Geolocation\config.php) file might be the best starting point. I can add the GeoLite2 City.mmdb and see what kind of damage I can do in a couple of hours.

Maybe you know this kind of stuff just because... 😃... if you had to guess, do you think, by adding a 59 meg file to the addon will make website load speed noticeably slower?


Of course! I didn't think about doing something for logged in clients but yea, you make good point about VPN. Using WHMCS 7.4.* and stock template, I thought it would be fancy for logged out clients to see something a tad-bit more welcoming. The idea is to make a landing page that converts and having a little bit extra touch of personal might help (or deter because it's creepy).

Alright, gonna dig my fingers into the keyboard.. thanks for feedback

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.


Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated