PDA

View Full Version : Fetching forum permissions


Chris M
14 Jul 2005, 21:27
This is driving me mad :p

It will not set the $limitfids variable, and I cannot for the life of me figure out why :(

// #################### PROCESS LATEST THREADS #######################
// fetch the permissions for each forum
global $vbulletin;

$forumperms = array();
foreach($vbulletin->forumcache AS $forum) {

$forumperms[$forum["forumid"]] = fetch_permissions($forum['forumid']);

// ## HIDE FORUMS WITHOUT THE CANVIEW PERMISSION ##
if ((!$forumperms[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums']) {
$limitfids .= ','.$forum['forumid'];
}
}
unset($forum);

Satan

Marco van Herwaarden
14 Jul 2005, 21:41
if ((!$forumperms[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums']) {

Try:
if (!($forumperms[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums']) {

Chris M
14 Jul 2005, 21:51
You're a genius :p

I've been trying every combination of code I can think of relating to permissions, and it comes down to the placement of the ! and the bracket -.-

Cheers Marco :)

Satan

Marco van Herwaarden
14 Jul 2005, 21:59
That is why it helps if you show it to someone 'fresh'.

You get blind for the obvious after staring at code for a while.

Marco van Herwaarden
14 Jul 2005, 22:00
Now you can go help me with my tri-state checkbox. :D

Chris M
14 Jul 2005, 22:00
Yeh - I figured it couldn't hurt for a fresh pair of eyes to take a look at something ;)

Usually you look so hard you ignore the tiniest mistakes and are thinking it must be something wrong with the whole chunk of code :)

Anyway, thanks again :)

Edit: I've taken a look at that thread actually ;)

I'm not sure what help I can be but I'll start googling for solutions :p

Satan

Marco van Herwaarden
14 Jul 2005, 22:12
Google didn't brought me the solution.

Chris M
14 Jul 2005, 22:46
Nor me :(

Satan