I guess you lock down your site from guests? Really I can not guess on your mods. In the gallery viewing permissions are set via category permissions via what usergroup a user is in.
without knowing more I really cant guess as all our variables are defined via various functions. That may work in our pp-inc.php file
Content visible to verified customers only.