Jake Bunce
Well-known member
This is a common request. A new template helper for group checking was recently added. This checks all of a user's groups, including secondary groups. This is useful if you want to display something in a template for members of a specific group.
You can use this code in the templates to display something for members of the specified user_group_id:
In the above example we are checking if the current logged in user ($visitor) is a member of user_group_id 4.
You can pass in any user record. For example, the message_user_info template contains the template code for the author box in posts. The user record for the author in that template is $user. So, for example, if we want to display something in the author box if the post author is a member of user_group_id 4 then we can use this:
You can use this code in the templates to display something for members of the specified user_group_id:
Code:
<xen:if is="{xen:helper ismemberof, $visitor, 4}">
stuff to display for members of user_group_id 4
</xen:if>
In the above example we are checking if the current logged in user ($visitor) is a member of user_group_id 4.
You can pass in any user record. For example, the message_user_info template contains the template code for the author box in posts. The user record for the author in that template is $user. So, for example, if we want to display something in the author box if the post author is a member of user_group_id 4 then we can use this:
Code:
<xen:if is="{xen:helper ismemberof, $user, 4}">
stuff to display for members of user_group_id 4
</xen:if>