Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
Hiya all! Hope you are all well.

I know there is a template somewhere that lets you have the same look and feel for normal HTML pages, which is great, but what I would love to have, is the ability to have those pages controlled by user groups.

I want to start a members area, and ideally would like to keep that control within UBBT.. ie if your not in the group you get directed to an error page or get an error message.

Its quite possible that this is already here, but Josh suggested over at Infopop that I come over here and ask you happy people!

Thanks in advance
Matt

Sponsored Links
Joined: Mar 2001
Posts: 644
Member
Member
Offline
Joined: Mar 2001
Posts: 644
I've done this myself with a few pages. So only a certain group can access the page.

Using the information on This Thread I set up some pages for members of my guild to be able to update/edit/add characters to our roster.

This is all accessible through a new link I've set to be displayed in their My Home, if they are a member of our guild group.

It was pretty easy.

I've been insanely busy lately with work, but if you remind me I can probably document what I did...

Joined: Nov 2001
Posts: 134
Journeyman
Journeyman
Offline
Joined: Nov 2001
Posts: 134
Reminded

Joined: Mar 2001
Posts: 644
Member
Member
Offline
Joined: Mar 2001
Posts: 644
Thanks Matt, slipped my mind of course. Sorry about that.

Will post some code snippets that I've used here in a few hours. (when I get home )

Joined: Mar 2001
Posts: 644
Member
Member
Offline
Joined: Mar 2001
Posts: 644
Example of page access control using groups:

Right after the include statements I grab the user's information. As follows:

Code
 <br /><br />//Snag Authentication stuff<br />$userob = new user;<br />$user = $userob -> authenticate("U_Groups");<br />$Username = $user['U_Username'];<br />$UserID = $user['U_Number'];<br /><br />


Ok got their info, now let's send the header and drop an IF... ELSE in to check the group permissions.

Code
<br /><br />// ------------------<br />// Send a html header<br />   $html = new html;<br /><br />// Let's authenticate the user to see if they have proper group permissions to access this page<br />// If they aren't authorized, get them outta here!<br />   if (!preg_match("/$config[Permissions_Group]/", $user[U_Groups]) ) {<br />   	$html -> not_right("I'm sorry, you do not have permissions to access this form. If you feel this is in error, please contact the administrator.");<br />   }<br />   else {<br />   .... send them on to the page/form whatever...<br />   }<br /> 


Look closely at the IF... the "Permissions_Group" is a variable you'll set in your Config Settings in the admin section.

At the bottom of the config page you can add your own variables. Add something like this:

Code
<br />$config['Permissions_Group'] = '5';<br />


Of course group 5 is the group I'm using, just substitute your group number in there.

Hope that helps.

Attached is a screenshot of the error produced.
Attachments
98635-error.jpg (0 Bytes, 19 downloads)

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)