6
Well, I had an issue similar to this. I didn't mind if users saw the submenu, I just didn't want them to be able to use it. To get around this, I used the following code:
//mlynch hack to check if member of group X
$perid = $xoopsUser->getVar('uid');
$grpid = 4 //Set this to the group id you want to allow
$allow = 0;
$result = $xoopsDB->query("select uid from xoops_groups_users_link where groupid = '$grpid' and uid = '$perid'");
while ( list($uid) = $xoopsDB->fetchRow($result) ) {
$person = $uid;
if ($perid != $person) {
$allow = 0;
} else {
$allow = 1;
list($uid) = $xoopsDB->fetchRow($result);
}
}
if ($allow != 1) {
redirect_header("index.php", 0, _NOPERM);
exit();
}
//end mlynch hack
The above code goes after this bit in the files I want to protect:
if (empty($xoopsModuleConfig['anonpost']) && !is_object($xoopsUser)) {
redirect_header("index.php", 0, _NOPERM);
exit();
}
I'm no pro by any means, so it may be messy, but it works for me...
*edit* Working example of this code at:
http://craig.spherens.comusername: testtest
password: password
After logging in, try to Submit News and you will get redirected for not having proper access. The site users that are in the custom group 'Journalists' are able to get to the page and submit news.