I opened showthread.php and found this code which deals with if the user has permission to view the thread:
PHP Code:
// *********************************************************************************
// check forum permissions
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
{
print_no_permission();
}
The
fetch_permissions function can take an optional second parameter to fetch permission for another user...
So I have this in a plugin:
PHP Code:
$bopguest = 0;
$bopguest = fetch_userinfo($bopguest);
$forumperms = fetch_permissions($threadinfo['forumid'], $bopguest);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
{
$joetest = "NO PERMISSION";
}
else
{
$joetest = "ok";
}
if $bopguest equals any true userid it works as expected... however to get guest/not-logged-in permission I thought maybe I could set $bopguest = 0. But that doesn't work I always get no permission even when guests do have permission... and yes $threadinfo['forumid'] is valid on the hook I am using.
Any ideas? I don't see any special code to deal with guests only...