Quote:
Originally Posted by Logician
Edit wt_wt.php, find:
PHP Code:
print_membergroup_row("Disallowed Usergroups <br><font size='1'>Mark usergroups who can <b>NOT</b> display this page</font>", 'webtemplate[banusergroupids]', 2, "");
replace it as:
PHP Code:
$usergroups = $vbulletin->db->query_read("SELECT usergroupid,title FROM " . TABLE_PREFIX . "usergroup ORDER BY title");
while ($usergroup = $vbulletin->db->fetch_array($usergroups))
{
$usergrps_with_space .= $usergroup[usergroupid]." ";
}
$webtemplatebanusergroups[membergroupids] = convert_WTfield_to_usergroup_array($usergrps_with_space);
print_membergroup_row("Disallowed Usergroups <br><font size='1'>Mark usergroups who can <b>NOT</b> display this page</font>", 'webtemplate[banusergroupids]', 2, $webtemplatebanusergroups);
Run this query and see if it will help:
PHP Code:
ALTER TABLE `wt35_webtemplate` CHANGE `banusergroups` `banusergroups` MEDIUMTEXT NOT NULL ,
CHANGE `logvisitors` `logvisitors` MEDIUMTEXT NOT NULL ,
CHANGE `editors` `editors` MEDIUMTEXT NOT NULL
|
Logician,
Thanks for the quick reply and the fix. It worked as far as it was designed, but unfortunately my original request was flawed.
I have 12 "Primary" usergroups. All members belong to at least one of these groups. I also have a couple hundred "Secondary" usergroups, most members belong to several of these each. Using the "Opt-out" paradigm you have here, it is impossible for me to allow access to secondary usergroups without also granting access to entire primary usergroups
Example: If a user is a member of primary group 1 and secondary group A, If I try and block access to Primary Group 1 and allow access to Secondary Group A then the user will still not be allowed access because the way you have it written all users that are in primary group 1 are denied access.
So I re-wrote your permissions function in your include file to switch the whole system to an "Opt-in" paradigm so that it better matches how vbulletin usually treats permissions. Can you take a look at this and let me know if it looks ok? I have tested it out and it seems to work fine. The only thing I needed to disable was the "Restrict individual users" function that you had, other wise granting access to a user with userid = 20 also grants access to the usergroup with usergroupid = 20.
PHP Code:
function WT_UsergroupPermission($userinfo, $return10 = 1, $usergroupname = '')
{
global $WT;
$permitted = 0;
$WT['banusergroups'] = trim($WT['banusergroups']);
if ($WT['banusergroups'])
{
$WT_banusergroups = explode(" ", $WT['banusergroups']);
if (WTis_member_of($userinfo, $WT_banusergroups))
{
$permitted = 1;
}
else
{
$permitted = 0;
}
/* if ($userinfo[userid] > 0 AND in_array('('.$userinfo[userid].')', $WT_banusergroups))
{
$permitted = 0;
} */
}
if ($WT['draft'] == 1 AND !WTis_member_of($userinfo, array("6"))) //draft webtemplate
{
$permitted = 0;
}
if ($return10) //return 1 or 0
{
return $permitted;
}
else //return usergroup name with color (permitten green, banned red)
{
if ($permitted)
{
return '<font color="#006600">'.$usergroupname.'</font>';
}
else
{
return '<font color="#C40000">'.$usergroupname.'</font>';
}
}
}