Checking BB Usergroup's for Access to a few Modules

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Checking BB Usergroup's for Access to a few Modules
Drunk
CZ Newbie
Drunk has been a member for over 19 year's 19 Year Member
usa.gif
Occupation: Married
Gender: Male
Website:
Status: Offline
Joined: Jan 31, 2005
0.00 posts per day
Posts: 4
Points: 117
   
Hi, I am trying to create a module (yea, yea, another guy, another story) that will only allow certain people to access. I want to be able to have the module check the user's name against the list for a certain user group.

Thanks for any help.

Drunk! icon_twisted.gif



Back to top Reply with quote
#2   re: Checking Usergroup for Access to a few Modules
dkwds
CZ Active Member
dkwds has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student
Age: 38
Gender: Male
Website:
Status: Offline
Joined: Jul 29, 2004
0.04 posts per day
Posts: 282
Points: 12,713
   
This may or may not help you. If yours is a new site you could switch to phpNuke Platinum (you can get it at [ Register or login to view links on this board. ] It has a module with this feature already installed in it. I don't really know where you can download the module by itself.




_________________
Back to top Reply with quote
#3   
Telli
Site Admin
Telli has been a member for over 20 year's 20 Year Member
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.06 posts per day
Posts: 8089
Points: 494,430
   
BBuser group? Or some other group system you have made?




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#4   re: Checking Usergroup for Access to a few Modules
Drunk
CZ Newbie
Drunk has been a member for over 19 year's 19 Year Member
usa.gif
Occupation: Married
Gender: Male
Website:
Status: Offline
Joined: Jan 31, 2005
0.00 posts per day
Posts: 4
Points: 117
   
I am talking about the forum User Groups. I would like to check the user names against them group so I know only certain people can get in.

Thanks again,
Drunk! icon_twisted.gif



Back to top Reply with quote
#5   
Telli
Site Admin
Telli has been a member for over 20 year's 20 Year Member
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.06 posts per day
Posts: 8089
Points: 494,430
   
That is not as easy as it sounds. Are you going to add a permission check in each module or block? You would probably want the system to do it for you right? The CMS we run on this site has the bbuser groups used everywhere including Messages, Modules, Blocks. Its a system I wrote but I don't think you could just add it. It would require a major overhaul of most of your Nuke core files. Sorry but there is no easy answer to this question. I know there a few hacks out there for groups (not bbuser groups) you may want to look for those.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   re: Checking Usergroup for Access to a few Modules
Drunk
CZ Newbie
Drunk has been a member for over 19 year's 19 Year Member
usa.gif
Occupation: Married
Gender: Male
Website:
Status: Offline
Joined: Jan 31, 2005
0.00 posts per day
Posts: 4
Points: 117
   
Well, first of all, thanks for the reply.

And as for what I want... I was thinking all I would have to do is some type of cookie check in the modules that I want to use it. Just doing that wouldn't work?

Thanks,
Drunk! icon_twisted.gif




_________________
Back to top Reply with quote
#7   
Telli
Site Admin
Telli has been a member for over 20 year's 20 Year Member
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.06 posts per day
Posts: 8089
Points: 494,430
   
Ok try putting this into your mainfile.php at the bottom is fine.


function in_bbgroup($user_id, $group_id) {
     global $db, $prefix;
     $group_id = intval($group_id);
     $user_id = intval($user_id);
     if (isset($user_id)) {
         $result = $db->sql_query("SELECT * FROM {$prefix}_bbuser_group WHERE group_id='$group_id' AND user_id='$user_id' AND user_pending='0'");
         if ($db->sql_numrows($result) > 0) {
              return true;
         } else {
              return false;
         }
     } else {
         return false;
     }
}


Then where you want to use it just put this:


//Put the group_id here that can get in
$group_id = 1;
if (in_bbgroup($cookie[0], $group_id)) {
      ALL YOUR PAGE HERE
} else {
      MESSAGE FOR NOT ALLOWED USER
}


You could also edit your modules.php and have it list the groups that way you can check this automatically instead of adding it into each module.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#8   re: Checking Usergroup for Access to a few Modules
Drunk
CZ Newbie
Drunk has been a member for over 19 year's 19 Year Member
usa.gif
Occupation: Married
Gender: Male
Website:
Status: Offline
Joined: Jan 31, 2005
0.00 posts per day
Posts: 4
Points: 117
   
That seems to work perfectly. Thank you very much.

Drunk! icon_twisted.gif




_________________
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