2015-10-31, 07:18 PM
I'm attempting to display a different message to the user according with his usergroups.
Right now I want the user to see the messages:
-"licensedBLS" if he's inside Super Moderators and Administrators groups at the same time
-"licensedGEN" if he's inside Super Moderators only
-"UNLICENSED" if he isn't inside any of them (Super Mods and Admins)
Can somebody check my code?
It always prints the text "licensedGEN" even if I'm inside both groups (Admin is primary and S.Mods secondary)
Right now I want the user to see the messages:
-"licensedBLS" if he's inside Super Moderators and Administrators groups at the same time
-"licensedGEN" if he's inside Super Moderators only
-"UNLICENSED" if he isn't inside any of them (Super Mods and Admins)
Can somebody check my code?
It always prints the text "licensedGEN" even if I'm inside both groups (Admin is primary and S.Mods secondary)
<?php
$groups = $mybb->user['usergroup'];
if($mybb->user['additionalgroups'])
{
$groups.= "," . $mybb->user['additionalgroups'];
}
$explodedgroups = explode(",", $groups);
$canview = 0;
$allowedgroups = array(3);
$allowedgroups2 = array(4);
foreach($explodedgroups as $group)
if(in_array($group, $allowedgroups, $allowedgroups2))
{
$canview = 1;
echo 'licensedBLS';
} else {
if(in_array($group, $allowedgroups))
{
$canview = 1;
echo 'licensedGEN';
}
}
if(!$canview)
{
echo'UNLICENSED';
}
?>