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

XF 1.4 Duplicate post - ad_message_below

Discussion in 'Troubleshooting and Problems' started by Pr0xy_5pid3r, May 11, 2015.

  1. Pr0xy_5pid3r

    Pr0xy_5pid3r New Member

    Hey Everybody,

    I am using Google Adsense and have noticed that messages posted in my forums are being duplicated when they have adsense code attached to them. Here is my code:

    <xen:if is="!{xen:helper ismemberof, $visitor, 5, 6, 7}">
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 5 AND !{$message.conversation_id}">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    (adsbygoogle = window.adsbygoogle || []).push({});

    So I only show ads on the every 5 messages, I noticed that in 2 separate posts, the message that was supposed to have this code attached has been duplicated. Does anyone know what this may be or have experienced this? Thanks!
  2. Pr0xy_5pid3r

    Pr0xy_5pid3r New Member

    What I'd like to try is only apply the ad code if the post has existed for a minute to see if it's a weird timing issue, does anyone know how I can check how long a post has lived?
  3. Pr0xy_5pid3r

    Pr0xy_5pid3r New Member

    I believe I may have fixed this by adding a " AND !{$post.canEdit}" to the check, this should prevent the ad from showing up if the user can edit the post (within the edit time limit)

Share This Page