In this part of the FastWebHost’s GeoIP tutorial we will show how to implement the GeoIP functionality in several of the most popular php forum scripts.
GeoIP Implementation in vBulletin
VBulletin is a widely used php forum script. More details about its installation and the functionality can be found in the FastWebHost’s comprehensive vBulletin tutorial:
The GeoIP addon file mip-geoiptracker-1.0.xml can be downloaded from the following location:
It should be installed through your vBulletin admin control panel -> Plugins & Products -> Manage Products -> Add/Import Product.
Next, you should get the geoip.inc and the GeoLite Country Binary Format files. Extract the archive of the last file on your local computer and then upload both the files in the includes folder of your vBulletin script.
In this way the GeoIP solution is integrated in your vBulletin forum.
You can use it by including one of the following code excerpts:
The first one should be included in the templates code and the second one is suitable for the php files code.
For example, if you want to visualize the country of your web site visitors in your forum’s navigation bar you should edit the navbar template. This can be completed through your vBulletin admin control panel -> Styles & Templates -> Style Manager -> Edit Templates -> Go -> Navigation / Breadcrumb Template -> navbar.
Insert the following code just above the </div> <!– / nav buttons bar –> lines:
<tr>Country Location: <br /> <if condition="$bbuserinfo[country] == 'US'">Home Country:<br/> $bbuserinfo[country] <else />Foreign Country: <br /> $bbuserinfo[country]</if> </tr>
You can modify the code per your needs.
The result can be seen on the main page of your forum: