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.
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
I would I go about allowing, say, five member groups access to a certain page and noone else?
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
I got errors when trying that.
Can't remember what they said though.
yea didn't work for me either sorry :( After trying. . .
<?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]
Thank you. :)
Would using a permission be a better method?
Yes, but it'd be more complicated enough that it's not a big deal.
-[Unknown]