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

Adding information to a profile depending on usergroup

Discussion in 'Styling and Customization Questions' started by Staxed, Mar 19, 2012.

  1. Staxed

    Staxed Active Member

    Hello,

    I found a resource a few days ago that I liked, but I edited to work with groups rather than user IDs (well...i thought I did). I just thought about it today and realized I did the wrong thing.

    I am trying to get a message to show on a members profile if they are a member of certain groups. But what I managed to do was have it show TO members of those groups, rather than putting it on their profile pages.

    I can't seem to find the variable to use for the group.

    This is the wrong code I used that gives me the effect I don't want:

    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, x, y}">
    This is the original code that works the way I want, but I want to change the user IDs to Group IDs (including secondary groups hopefully).

    Code:
    <xen:if is="{$user.user_id} == 1 OR {$user.user_id} == 2 OR {$user.user_id} == 5">
    What do I need to replace $user.user_id with to make it use a group ID instead...I've searched, and I can't seem to find it (is it listed somewhere and I'm looking in the wrong spot?)

    EDIT:

    I figured out that $user.user_group_id works for the primary group, but I'm now trying to figure out the secondary group stuff. I used a dump of $user and it showed a parameter of secondary_group_ids but it doesn't seem to work when I use it.
     
  2. borbole

    borbole Well-Known Member

    It is hard to give an advice without seeing the whole picture, well, code in this case. Anyway, it would be better if you posted at that mod 's suppport thread about this.
     
  3. Staxed

    Staxed Active Member

    Posting in the mod thread won't be any better than this thread, as it's just a template mod, and the template coding is the part I'm having an issue with...it's not related to the rest of the code at all...

    I'm just trying to figure out what the correct syntax for secondary groups is in a template...and I have the examples of the code posted above. I can do it for users and primary groups, I just can't seem to get secondary groups working...

    right now I'm using
    Code:
    <xen:if is="{$user.user_group_id} == 1 OR {$user.user_group_id} == 2 OR {$user.user_group_id} == 5">


    I used a {xen:helper dump, $user} and found that the parameter for secondary groups is secondary_group_ids...but it doesn't seem to work, that's really my only question....is how to get this code working with secondary group IDs.

    I tried the below, but it still doesn't seem to take secondary groups into account.

    Code:
    <xen:if is="{$user.user_group_id} == 1 OR {$user.user_group_id} == 2 OR {$user.user_group_id} == 5 OR {$user.secondary_group_ids} == 1 OR {$user.secondary_group_ids} == 2 OR {$user.secondary_group_ids} == 5">
     
  4. borbole

    borbole Well-Known Member


    Well, this part:

    HTML:
    <xen:if is="{xen:helper ismemberof, $visitor, x}">
    code here
    </xen:if>
    should include secondary groups too.

    And replace x with the id of the group that you want o show/do your thing. To check for 2 groups for example, use this:

    HTML:
    <xen:if is="{xen:helper ismemberof, $visitor, x} OR {xen:helper ismemberof, $visitor, x}">
    code here
    </xen:if>
    Again replace x with the id of the groups.
     
  5. Staxed

    Staxed Active Member

    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, x}">code here
    </xen:if>
    I posted the current code I am using in my second post...that code does not work for what I am trying to do. That shows it to a group of members, I am trying to get it to show on a specific groups profile pages.

     
  6. Staxed

    Staxed Active Member

    ok, I got it...I was being silly as always...answer right in front of me...

    I just needed {xen:helper ismemberof, $user, x} instead of {xen:helper ismemberof, $visitor, x}
     

Share This Page