Who ever developed this obviously never though of the forum been installed within a sub directory.....
and when the admin black lists their domain from the referrer.
Take the following.
Your addon will only work if the forum is installed within root of the server such as
www.mysite.com
but when the forum is installed within
www.mysite.com/the/forum/index.php
it does not work.
there is a portal which gives a brief explanation about the website, (this portal has no open connection to the database) and has a link to direct the visitor to the forum. When someone googles for this website the portal URL comes up, and when the user clicks this the entry to be directed to the portal, and then when they have finished looking around and click the forum link to be redirected to the forum, the entry is not recoded in your mod.
For people who has this situation, and are using the current version of the mod, it would be best not to black list your own domain name.
I have made changes to your code to substitute for the mis-placed logic.
You should update your mod to include this.