Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Waste on November 11, 2004, 10:26:28 PM

Title: SSI certain member group access only
Post by: Waste on November 11, 2004, 10:26:28 PM
I am trying to figure out how to use the welcome script from the basic SSI tutorial to only allow certain member groups.
I got it to work for admins and block guests, but can't figure out how to allow one other member group in and not all members.
Title: Re: SSI certain member group access only
Post by: Jerry on November 12, 2004, 12:52:37 AM
try reading the SSI FAQ:
http://www.simplemachines.org/community/index.php?topic=14906.0

or more specifically in the Expert FAQ page:
http://www.simplemachines.org/community/index.php?topic=13205.msg139384#msg139384
Title: Re: SSI certain member group access only
Post by: Waste on November 13, 2004, 10:09:19 PM
I would I go about allowing, say, five member groups access to a certain page and noone else?
Title: Re: SSI certain member group access only
Post by: Jerry on November 13, 2004, 10:23:46 PM
probably something like this

<?php

if (in_array(9, $user_info['groups']) || in_array(12, $user_info['groups'] || in_array(14, $user_info['groups'] || in_array(16, $user_info['groups'] || in_array(18, $user_info['groups']))
{
   echo
'Yay! Im in group 9 ';

else
{
   echo
'We are sorry, it seems you dont have access to this page.';
}

?>
unkown probably has a better way though ;D
Title: Re: SSI certain member group access only
Post by: Waste on November 13, 2004, 10:25:25 PM
I got errors when trying that.
Can't remember what they said though.
Title: Re: SSI certain member group access only
Post by: Jerry on November 13, 2004, 10:26:56 PM
yea didn't work for me either sorry :( After trying. . .
Title: Re: SSI certain member group access only
Post by: [Unknown] on November 14, 2004, 04:20:45 AM
<?php

require_once('/path/to/SSI.php');

global
$user_info;

if (
in_array(9, $user_info['groups']) || in_array(12, $user_info['groups']) || in_array(14, $user_info['groups']) || in_array(16, $user_info['groups']) || in_array(18, $user_info['groups']))
{
   echo
'Yay! I\'m in a special group!';

else
{
   echo
'We are sorry, it seems you dont have access to this page.';
}

?>


Once you've got that many, though, you almost want to use a permission instead...

-[Unknown]
Title: Re: SSI certain member group access only
Post by: Waste on November 14, 2004, 12:24:38 PM
Thank you. :)

Would using a permission be a better method?
Title: Re: SSI certain member group access only
Post by: [Unknown] on November 15, 2004, 02:53:30 PM
Yes, but it'd be more complicated enough that it's not a big deal.

-[Unknown]