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

XF 1.4 Differentiate between two groups of users quickly

Discussion in 'XenForo Questions and Support' started by JackieChun, Jul 7, 2015.

  1. JackieChun

    JackieChun Active Member

    I need to be able to differentiate quickly between paid and unpaid posters on the forum and see which member belongs to which group directly from the thread view. It doesn't have to be a special title or anything like that, just a visible tag (like an icon or an asterisk) for either or both groups.

    What is the quickest and most efficient way to do this?
     
  2. Amaury

    Amaury Well-Known Member

    Unless I'm misunderstanding, you can just apply different text color to the two user groups.
     
  3. JackieChun

    JackieChun Active Member

    I don't want the members to know that there are paid posters or see who's in which group. Only the admin should be able to see this.
     
  4. Amaury

    Amaury Well-Known Member

    Try placing this in the template wherever you want it:

    Code:
    <xen:if is="{$visitor.is_admin}">Paid</xen:if>
    You can also phrase it, but I recommend prefixing it with your forum's initials so you know it's custom:

    Code:
    <xen:if is="{$visitor.is_admin}">{xen:phrase initials_paid}</xen:if>
     
  5. JackieChun

    JackieChun Active Member

    What is "Paid" in this case? A group, a title, a custom database field?
     
  6. Amaury

    Amaury Well-Known Member

    I spaced out.

    You'll need two conditionals, I think--the admin one above and another one. You already have Unpaid and Paid user groups, I presume. One conditional will show Paid to everyone in the latter user group (use the user group ID) and the other one will show that only to admins--wrap the user group one within the admin one.

    Have a look at @Brogan's Conditional Statements resource for help.
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    This is likely the most complete solution:

    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, 3, 4}">
        <xen:if is="{xen:helper ismemberof, $user, 9, 10}">
            PAID MEMBER
        </xen:if>
    </xen:if>
    If you were to add that to, e.g. the message_user_info template, e.g. next to the username or user title (you may need to adjust the styling accordingly), that would show the words PAID MEMBER next to users who are in user group 9 or 10 and that would only appear to visitors in user group 3 or 4.
     
    JackieChun, Andrej and Amaury like this.
  8. Brogan

    Brogan XenForo Moderator Staff Member

    I do something similar on my own site and use template modifications to do so, very similar to @Chris D's solution.

    upload_2015-7-7_21-6-40.png

    upload_2015-7-7_21-7-40.png

    upload_2015-7-7_21-9-14.png
     
  9. JackieChun

    JackieChun Active Member

    Thank you @Chris D and @Brogan. So I would need to create a new group and manually add all the paid members to this group as a secondary membership, is that correct?

    Brogan, which add-on are you using in your screenshots? Are you using an add-on instead of modifying the template to prevent these changes from being overwritten when the style is updated?
     
  10. Brogan

    Brogan XenForo Moderator Staff Member

    You can add them manually or create a user group promotion.

    I have just packaged the changes into an add-on but it's not necessary.
     

Share This Page