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

XF 1.5 Text before and after first post in the thread.

#1
I'm trying to edit the ad_message_body to make certain text appear in the beginning and at the end of the post. I am only able to get a line of text to appear in the beginning.

I'm trying to get the text in the message body itself, not after or before it.
 

Brogan

XenForo moderator
Staff member
#8
Yes, you can use a conditional statement utilising the node id, the thread first post id and the message post id.
Code:
<xen:if is="{$forum.node_id} == 1 AND {$thread.first_post_id} == {$message.post_id}">
    Content
</xen:if>
Change the 1 to the actual node ID.
 
#9
Here's how my code is set up


PHP:
<article>
                <blockquote class="messageText SelectQuoteContainer ugc baseHtml{xen:if $message.isIgnored, ' ignored'}">
                    <xen:include template="ad_message_body" />
               
                    <xen:if is="{$forum.node_id} == 8 AND {$thread.first_post_id} == {$message.post_id}">
                    [code]</xen:if>
                    {xen:raw $message.messageHtml}
                    <xen:if is="{$forum.node_id} == 8 AND {$thread.first_post_id} == {$message.post_id}">
                    [/code]</xen:if>

                    <div class="messageTextEndMarker">&nbsp;</div>
                </blockquote>
            </article>
But when I put this in and make a thread, the code tags don't work on the forum.


Any way to fix this? Thanks in advance @Brogan you've been very helpful, I really appreciate it.

Btw, the comment in the thread was just to show the code tags are actually working
 

Brogan

XenForo moderator
Staff member
#10
Why are you trying to wrap the message content in code tags?

Your initial request sounded like you just wanted to add some text either side of the post content but now it seems like you are trying to do something specific.
 
#11
Why are you trying to wrap the message content in code tags?

Your initial request sounded like you just wanted to add some text either side of the post content but now it seems like you are trying to do something specific.
I needed a certain section to force users to have to reply to the post before viewing it. It's a 3rd party plugin but the code tags have the same exact concept and it's preloaded with Xenforo. I know you guys don't support 3rd party related issues so I showed the example with the code tags.

I know my request was just adding text, I thought that it would automatically work with the code tags, and it didn't.

So now I'm just wondering if there's a way for those code tags to automatically work on the thread post.

And sorry for this stupid request, if there's any way you can help me fix this issue it would be greatly appreciated @Brogan
 

Brogan

XenForo moderator
Staff member
#12
You would be better off asking the developer of the add-on to add some additional functionality, or advise how it can be achieved with a code edit.