I want to take advantage of the Forums User Group feature..

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   I want to take advantage of the Forums User Group feature..
Larcen
CZ Super Newbie
Larcen has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 36
Points: 1,270
   
Meaning, I want to do a check at the begining of my content/custom modules to only allow a certain Forum User GRoup to view them. I know the Content module has its 'Registered Users Only' feature but thats not enough, I only want to allow the users of a certain group to view the content module -and- my custom made modules I made for my site. Before I go ripping through the forums to try and figure out what funtions/queries are used when limiting access in forums per user groups I was wondering if someone already knew and was willing to share..



Back to top Reply with quote
#2   re: I want to take advantage of the Forums User Group featur
Larcen
CZ Super Newbie
Larcen has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 36
Points: 1,270
   
Well I figured I would start poking around and decided to test my theory so far like this:


$user_check = explode(":", $nukeuser);
$privresult = mysql_query("SELECT group_id FROM nuke_bbuser_group where user_id='".$user_check[0]."'");
$userrow = mysql_fetch_array($privresult);
OpenTable();
echo "
$nukeuser<br>
$user_check[0]<br>
$userrow[0]";
CloseTable();


Now while I get back the correct information, when I go in to check and find out what the particular group I want to allow/disallow I don't get it. The group_id for 'Citizens' (which is the one I want) is 197. Cool! Right? No, in bbuser_group both users that -are- in the group and aren't in the group are associated with 197 and other groups as well. I don't get it. How can their user_id be set to a group_id that isn't the group_id of 'Citizens' which is 197 yet still have the permissions of 'Citizens' Someone enlighten me?


Back to top Reply with quote
#3   re: I want to take advantage of the Forums User Group featur
Larcen
CZ Super Newbie
Larcen has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 36
Points: 1,270
   
This has to be the ugliest piece of code I've ever written, but it works, if anyone has any better ideas please share them..

$user_check = explode(":", $nukeuser);
$privresult = mysql_query("SELECT group_id FROM nuke_bbuser_group where user_id='".$user_check[0]."'");
while($row = mysql_fetch_row($privresult))
           {
               foreach($row as $i => $value) {
                if ($value==197)
                        {
                               $approved = "1";
                               break;
                        }  else {
                               $approved = "2";
                        }
                 }
         }
if ($approved != 1)
      {
   OpenTable();
           echo "Access Denied.";
   CloseTable();
   die();
       } else {
....rest of my module
}



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum