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

XF 1.5 Message and ad under first post?

Discussion in 'Styling and Customization Questions' started by rickhz, May 30, 2016.

  1. rickhz

    rickhz Member

    I would like to have a box under each thread's first post within which I could place place text, and a banner ad to be visible to non-supporting members only.

    I'l looking for suggestions how to implement this.

    Thanks.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. rickhz

    rickhz Member

    This is what I came up with.

    Code:
    <xen:hook name="ad_message_below" />
    
    <xen:if is="!{xen:helper ismemberof, $visitor, 4, 5, 45, 54, 55, 56, 62, 68}">
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
        <xen:if is="!{$visitor.user_id}">
         <li class="message">
                <div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">
                    <div class="messageUserBlock">
                        <div class="avatarHolder">
                            <span class="helper"></span>
                            <xen:avatar user="$visitor" size="m" img="true" />
                        </div>
                        <h3 class="userText">
                        <span style="font-weight: bold">Support EF</span>
                        <em class="userTitle" itemprop="title"></em>
                        </h3>
                        <span class="arrow"><span></span></span>
                    </div>
                </div>
                <div class="messageInfo primaryContent">
                    <div class="messageContent">
                        <article>
                            <blockquote class="messageText ugc baseHtml">
                           
                              style type="text/css">
    .overtaking-top-dynamic {
    width: 320px;
    height: 50px;
    }
    
    @media(min-width: 484px) {
        .overtaking-top-dynamic {
        width: 468px;
        height: 60px;
        }
    }
    </style>
    
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- xen_below_message -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-1465533425503040"
         data-ad-slot="8105278131"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
                           
                           
                                <br /><br /><label for="LoginControl"><span style="font-weight: bold; color: #004400"><a href="login/" class="concealed noOutline">Log in or Sign up</a></span></label> to hide all adverts.
                            </blockquote>
                        </article>
                    </div>
                </div>
            </li>
        </xen:if>
    </xen:if>
    </xen:if>


    I chose to exclude so many user groups because I wasn't sure what would happen if I tried to serve to just the "Registered" group, since Xenforo wants all members to be in the "registered" group.

    In fact I am trying to show the ads to registered and unregistered members , and exclude my "Elite" group, moderators, admin, etc.

    The code above shows the new post with the avatar, etc, but it's also showing some of the code instead of rendering it. What did I goof up on?
     
  4. rickhz

    rickhz Member

    I think I found it... I was missing a "<"
     

Share This Page