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

XF 1.5 Having an issue getting the Ads to work with conditional statements

Discussion in 'XenForo Questions and Support' started by TheXboxCloud, Aug 31, 2015.

  1. TheXboxCloud

    TheXboxCloud Active Member


    I'm trying to place an ad in between the first and second post and also limit the ads to not show for administrators or any usergroup that has to do with me.

    I found the exact 2 statements and placed them in the ad_message_below template along with adsense code and a <div> tag to name the class as I found in another tutorial. I then used the class in Extra.css

    I tried with the statements in both the template and extra.css but neither worked.

    I'm not sure exactly which template is ideal for these statements as the tutorial did not say.

    Please direct me to the right way of doing this.

  2. Martok

    Martok Well-Known Member

    I presume you are using conditional statements from here.

    Conditional Statements

    They should do in the ad templates. You jut wrap the conditional around the ad code.
  3. TheXboxCloud

    TheXboxCloud Active Member

    I am and I did that but it still didn't work for some reason.
  4. Martok

    Martok Well-Known Member

    Maybe you could post an example of the code, saying what you want to happen and what is actually happening.

    Also what's the purpose of adding a class - to do what exactly?
  5. TheXboxCloud

    TheXboxCloud Active Member

    I'm following this tutorial:

    How To Create A Google Adsense Account And Install Ads

    This is my code for ad_message_below:

    <xen:if is="!{xen:helper ismemberof, $user, Administrator, Bots}">
    <xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
    <div class="longads">
    Ad code here
    Then I add this to extra.css:

    .longads {
    width:728px; margin-left: auto; margin-right: auto;
    The above code does not work for getting the ad to appear between the first and the second post.

    Furthermore it does not work for blocking out administrators and another usergroup I call "Bots" from seeing the ads.

    When I put the code in, the ads are still there.

    Possibly I am using the wrong template. Please explain to me the correct template to use in order to achieve this. Also, I would like to know what is the correct format for placing an ad. You say I don't need to use a class. So can anyone tell me how it should be done? Thanks.
  6. Brogan

    Brogan XenForo Moderator Staff Member

  7. TheXboxCloud

    TheXboxCloud Active Member

    I have read them. It says x, y

    I thought that meant to replace them with the usergroup you wanted?

    What does it mean?

    I also tried with $visitor and it didn't work either.
  8. Brogan

    Brogan XenForo Moderator Staff Member

    The user group IDs need to be used.
    TheXboxCloud likes this.
  9. TheXboxCloud

    TheXboxCloud Active Member

    Okay thanks. That clears up the question. I appreciate your help.

Share This Page