Quote:
Originally Posted by assassingod
// Coming Soon:
Thread Permissions (No need to manually exclude forums!)
|
assassingod you can use my permissions code from one of my hacks.
The function:
PHP Code:
function get_noaccess_forumids ( )
{
global $forumcache, $bbuserinfo ;
$_naforumids = array ( ) ;
$_naforumids[] = 0 ;
foreach ( $forumcache AS $forumid => $farray ) :
if ( ! ( $farray['permissions']["$bbuserinfo[usergroupid]"] & CANVIEW ) ) :
$_naforumids[] = $forumid ;
endif ;
endforeach ;
return $_naforumids ;
}
It use the forumcache to run through user permissions so it doesn't require a query to check which users can access which forums, though it doesn't run a check on the access masks it does do the forum permissions.
Then in the member.php? im guessing add:
PHP Code:
$forumids = implode ( "', '", get_noaccess_forumids ( ) ) ;
This takes the forums which users have no access to and sets it up for the sql statement.
Then in the WHERE section of the sql statement add:
PHP Code:
thread.forumid NOT IN ( '$forumids' )
Cheers,
g-force2k2