XF 1.5 Content duplicating after editing first post

Russ

Well-known member
So trying to place a manual ad in the message template AFTER closing </li>:

Code:
<xen:if is="{$post.position} == 0">
<li class="message">ad</li>
</xen:if>

Doing it this way as there's styling on the message class and don't want to use ad_message_below.

Problem is when you edit the first post the content "duplicates", reloading the page fixes it but anyway around it? I'm assuming the JS is just inserting the html again into the source code but I'd like to avoid that.

Code:

Screenshot_4.webp


Editing a few times results in:
Screenshot_3.webp

Really using any sort of HTML will duplicate example:
Code:
<span>test span</span>

This is testing on the default style, default XenForo just to make sure it wasn't something else.

I tried Brogan's method of using the ad template as well with this way: https://xenforo.com/community/threads/ad-after-first-post-which-template.17313/#post-226561 but same problem.

Thanks ahead of time... I've tried searching for a solution or if it has been brought up before with no luck.
 
The message system has no idea that the second <li> is part of the first message so it doesn't know to replace it. The post editing situation isn't one we have explicit detection for. You can detect it by certain variables not being available, such as $firstPost or $lastPost, though that might affect conversations as well. You'd basically need to skip outputting the ad if it's a dynamic replacement.
 
Back
Top Bottom