PDA

View Full Version : Fetching forum permissions


Chris M
07-14-2005, 08:27 PM
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
07-14-2005, 08:41 PM
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
07-14-2005, 08:51 PM
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
07-14-2005, 08:59 PM
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
07-14-2005, 09:00 PM
Now you can go help me with my tri-state checkbox. :D

Chris M
07-14-2005, 09:00 PM
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
07-14-2005, 09:12 PM
Google didn't brought me the solution.

Chris M
07-14-2005, 09:46 PM
Nor me :(

Satan