8
Wow !
Why do simple when we can do complicated ?
1st step, insert this in footer.php (if you just need this feature in one of your theme templates), or better: in class/template.php (to make it available in every template).
footer.php version define("XOOPS_FOOTER_INCLUDED",1);
[color=FF6666] if ( @$xoopsUser && is_object($xoopsUser) ) {
$xoopsTpl->assign( 'xoops_usergroups', $xoopsUser->getGroups() );
}[/color]
class/template.php version $this->Smarty();
[color=FF6666] global $xoopsUser;
if ( @$xoopsUser && is_object($xoopsUser) ) {
$this->assign( 'xoops_usergroups', $xoopsUser->getGroups() );
}[/color]
Now you can test if the user is a member of a specific group using something like this in your templates:
Quote:
<{if 1|in_array:$xoops_usergroups}>User is a member of group 1<{/if}>
<{if 2|in_array:$xoops_usergroups}>User is a member of group 2<{/if}>
To use the group name instead of its ID/number isn't recommended: the groupd Id will always stay the same, while you may want to change its display name in the future, whitout having to change all your templates.