XF 1.5 Content duplicating after editing first post


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

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

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.



Editing a few times results in:

Really using any sort of HTML will duplicate example:
<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.


XenForo developer
Staff member
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.