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

XF 1.1 Thread Creator Template Conditional

Discussion in 'XenForo Questions and Support' started by BamaStangGuy, Mar 21, 2013.

  1. BamaStangGuy

    BamaStangGuy Well-Known Member

    I need to have a conditional that won't show advertisements on threads created by a certain userid.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. BamaStangGuy

    BamaStangGuy Well-Known Member

    Haha, I was thinking that I had asked that before but couldn't find it for some reason. Guess I am blind.

    Thanks
     
  4. BamaStangGuy

    BamaStangGuy Well-Known Member

    Hmm this doesn't appear to work.

    Code:
    <xen:if is="{$thread.user_id} != 6859">
    <xen:if is="!{xen:helper ismemberof, $visitor, 9}">
    <!-- book_160x600 -->
    <div id='div-gpt-ad-1362983438283-0' style='width:160px; height:600px;'>
    <script type='text/javascript'>
    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1362983438283-0'); });
    </script>
    </div>
    </xen:if>
    </xen:if>
    That still shows advertisements for threads started by that member.
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Which template are you adding that to?
     
  6. BamaStangGuy

    BamaStangGuy Well-Known Member

    Three of the ad templates and page_container_js_head
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Ah, that conditional will only work in the post and message templates.
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Just checked with Mike and he suggested something like this.

    <xen:container var="$isThreadOwner">{xen:if '{$thread.user_id} == {$visitor.user_id}', 1}</xen:container>

    Then just <xen:if is="{$isThreadOwner}"> in the container.

    He also said to name the variable $hideAd or something so a different condition could be applied elsewhere and it would make sense.
     

Share This Page