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

XF 1.2 Hide ad from one specific user group

Discussion in 'Styling and Customization Questions' started by Mr Lucky, Dec 6, 2013.

  1. Mr Lucky

    Mr Lucky Well-Known Member

    I'm sure this must be easy. here is my code:

    Code:
    <xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
    <div style="width:100%;height:10px;margin-top:40px;background:#ffffff">AD HERE</div>
    </xen:if>
    How do I make it so that does not display to one specified usergroup?

    Thanks
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Mr Lucky

    Mr Lucky Well-Known Member


    Many thanks. I have read that but am not quite sure how I use it.

    Say I want the above to only display to one group, according to that page I use

    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, x}">
    So to show the above only to unregistered I have:

    Code:
    <xen:if is="{$post.position} == 0 AND !{$message.conversation_id}" AND is="{xen:helper ismemberof, $visitor, 1}" >
    <div style="width:100%;height:10px;margin-top:40px;background:#ffffff"></div>
    </xen:if>
    However I get this error:

     
  4. Sheratan

    Sheratan Well-Known Member

    How about:

    Code:
    <xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
    <xen:if is="{xen:helper ismemberof, $visitor, 1}" >
    <div style="width:100%;height:10px;margin-top:40px;background:#ffffff"></div>
    </xen:if></xen:if>
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    You can't use is=" inside the if statement.
     
  6. Mr Lucky

    Mr Lucky Well-Known Member

    can you explain a bit more for dummies, or give an example
    Thanks I'll try that
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Oops. Made a typo which completely changed the meaning of my previous post.

    I meant to post you can't use is=" inside the if statement, as you have done here:
    Code:
    <xen:if is="{$post.position} == 0 AND !{$message.conversation_id}" AND is="{xen:helper ismemberof, $visitor, 1}" >
    It should simply be:
    Code:
    <xen:if is="{$post.position} == 0 AND !{$message.conversation_id} AND {xen:helper ismemberof, $visitor, 1}" >
    
     
  8. Mr Lucky

    Mr Lucky Well-Known Member

    Ah, so the two ANDS is fine but you can only have one is
     
  9. Mr Lucky

    Mr Lucky Well-Known Member

    OK so far, many thanks for the help, but what I f I want to show to two usergroups

    Neither of these work, they show to all groups.

    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, 1, 2} ">
    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, 1} OR {xen:helper ismemberof, $visitor, 2} ">
     

Share This Page