Thats probally because of the way you do your sidebar maybe that stuff is called separately. The forumhome stuff is called in forumhome only. also you dont define a box for it. You actually make sure its clean output no templates. It has its own html to print stuff.
A have already responded you can not put that variable out of the forumhome script.
You have that $vbgallery code trying to load for every page of your site in the sidebar its not going to work or designed to work there.
Feel free to post in the support forums for more info or even the CODE MOD forums if you feel like discussing code modifications to acheive things that are not in the code.