Friday 04 April 2008 6:01:44 am
Hello, I'm trying to display different information depending on the usergroup of current_user. The issue that I'm running into is that every user is part of the "Users" usergroup, so I can't seem to be to use {case match='Anonymous'}. Here's the code that I'm using;
{foreach $user.groups as $key => $group}
{def $group=fetch( 'content', 'object', hash( 'object_id', $user.groups[$key] ) )}
{let groupn=$group.name}
{switch name=pagetester match=$groupn}
{case match='IE07'}
<p>You are a member of: <strong>IE07</strong><br />
You have access to the following sections:
<ul>
<li>Access to this</li>
<li>and that</li>
</ul></p>
{/case}
{case match='UE2'}
<p>You are a member of UE2</p>
{/case}
{case in=array(Anonymous, Users)}
<p> You are an anonymous user.<br />
You do not have access to this section, If you'd like to have access, please <a href="/publications/subscribe">click here</a>.
{/case}
{/switch}
{/let}
{/foreach}
This works only for anonymous, but when I log in as one of the other users, it doesn't seem to work. I am using {switch} because there will be about 10 usergroups.
|