1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Combine two conditionals?

Discussion in 'Troubleshooting and Problems' started by Luxus, Jun 23, 2012.

  1. Luxus

    Luxus Well-Known Member


    I have this code
    <xen:if is="{$user.user_group_id} == 3 AND {$user.user_group_id} == 6">
        <div class="userRank modMag"></div>
    What I want to achieve with this is a double user group conditional. If a user is in the usergroup 3 and usergroup 6, then he should get the class "modMag" (for a rank image). However it didn't work. I have also this code
    <xen:if is="{$user.user_group_id} == 3">
        <div class="userRank mod"></div>
    This code works instead of the above one. Is there a special conditional for secondary usergroups?

    EDIT: Nevermind, I just found this resource: http://xenforo.com/community/resources/user-group-badges-per-usergroup.588/
    Going to try it :)
  2. Arty

    Arty Well-Known Member

    Variable user_group_id points to user's main group. It can have only 1 value, so your statement will always return false.

    You need to use ismemberof helper:
    <xen:if is="{xen:helper ismemberof, $user, 3} AND {xen:helper ismemberof, $user, 6}">
  3. Luxus

    Luxus Well-Known Member

    Thank you for the information :)

Share This Page