get_user_groups($user); } $content = explode('///else///', $content); if (! empty($params['error'])) { $errmsg = $params['error']; } elseif (empty($params['error']) && isset($groups)) { $errmsg = ''; } else { $errmsg = 'Smarty block.display.php: Missing error param'; } $anon = false; // see the workaround to exclude Registered below foreach ($groups as $gr) { $gr = trim($gr); if ($gr == 'Anonymous') { $anon = true; } if (substr($gr, 0, 1) == '-') { $nogr = substr($gr, 1); if ((in_array($nogr, $userGroups) && $nogr != 'Registered') or (in_array($nogr, $userGroups) && $nogr == 'Registered' && $anon == true)) { // workaround to display to Anonymous only if Registered excluded (because Registered includes Anonymous always) $ok = false; $anon = false; } } elseif (! in_array($gr, $userGroups) && $anon == false) { $ok = false; } else { $ok = true; } } /* is it ok ? */ if (! $ok) { if (isset($content[1])) { return $content[1]; } else { return $errmsg; } } else { return $content[0]; } }